diff --git a/.vs/League-of-Legends_Project3/v17/.wsuo b/.vs/League-of-Legends_Project3/v17/.wsuo index 5e22404..e917b20 100644 Binary files a/.vs/League-of-Legends_Project3/v17/.wsuo and b/.vs/League-of-Legends_Project3/v17/.wsuo differ diff --git a/EntityFramework_LoL/Sources/Entities/ChampionDbContext.cs b/EntityFramework_LoL/Sources/Entities/ChampionDbContext.cs index 3a5665b..b2c8f8f 100644 --- a/EntityFramework_LoL/Sources/Entities/ChampionDbContext.cs +++ b/EntityFramework_LoL/Sources/Entities/ChampionDbContext.cs @@ -9,6 +9,11 @@ namespace Entities { public DbSet skins { get; set; } public DbSet champions { get; set; } + public DbSet skills { get; set; } + public DbSet runes { get; set; } + public DbSet runepages { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseSqlite($"Data Source=Entities.Champions.db"); @@ -16,22 +21,25 @@ namespace Entities protected override void OnModelCreating(ModelBuilder modelBuilder) { + modelBuilder.Entity().Property(e => e.Id).ValueGeneratedOnAdd(); + + modelBuilder.Entity().HasData(new List() { new() { Name = "Dave", Bio = "Le meilleur Jazzman de France", - Class = ChampionClass.Fighter + Class = ChampionClass.Fighter, + }, new() { - Name = "Armure", + Name = "Armure", Bio = "Solide", - Class = ChampionClass.Tank + Class = ChampionClass.Tank, } }); - modelBuilder.Entity().HasData(new List() { new SkinEntity { @@ -50,6 +58,46 @@ namespace Entities Price=9.99F }, }); + + modelBuilder.Entity().HasData(new List() { + new() + { + Name = "Boule de feu", + Description = "Fire!", + SkillType = SkillType.Basic + }, + new() + { + Name = "White Star", + Description = "Random damage", + SkillType = SkillType.Ultimate + } + }); + + modelBuilder.Entity().HasData(new List() + { + new() + { + Id = Guid.NewGuid(), + Name="Runepage_1" + } + }); + + modelBuilder.Entity().HasData(new List() { + new() + { + Name = "Bullseye", + Description = "Steady shot", + RuneFamily = RuneFamily.Precision + }, + new() + { + Name = "Alkatraz", + Description = "Lock effect", + RuneFamily = RuneFamily.Domination + } + }); + } } } diff --git a/EntityFramework_LoL/Sources/Entities/ChampionEntity.cs b/EntityFramework_LoL/Sources/Entities/ChampionEntity.cs index 8ed2a5c..eea4371 100644 --- a/EntityFramework_LoL/Sources/Entities/ChampionEntity.cs +++ b/EntityFramework_LoL/Sources/Entities/ChampionEntity.cs @@ -1,5 +1,7 @@ using Shared; using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + namespace Entities { public class ChampionEntity @@ -13,6 +15,8 @@ namespace Entities public string? Icon { get; set; } [Required] public ChampionClass Class { get; set;} + + public virtual ICollection? Skills { get; set; } } } diff --git a/EntityFramework_LoL/Sources/Entities/Entities.Champions.db b/EntityFramework_LoL/Sources/Entities/Entities.Champions.db index 2643996..301c8f4 100644 Binary files a/EntityFramework_LoL/Sources/Entities/Entities.Champions.db and b/EntityFramework_LoL/Sources/Entities/Entities.Champions.db differ diff --git a/EntityFramework_LoL/Sources/Entities/Entities.Champions.db-shm b/EntityFramework_LoL/Sources/Entities/Entities.Champions.db-shm index 18b64da..9cd8351 100644 Binary files a/EntityFramework_LoL/Sources/Entities/Entities.Champions.db-shm and b/EntityFramework_LoL/Sources/Entities/Entities.Champions.db-shm differ diff --git a/EntityFramework_LoL/Sources/Entities/Entities.Champions.db-wal b/EntityFramework_LoL/Sources/Entities/Entities.Champions.db-wal index c9dd033..c02c794 100644 Binary files a/EntityFramework_LoL/Sources/Entities/Entities.Champions.db-wal and b/EntityFramework_LoL/Sources/Entities/Entities.Champions.db-wal differ diff --git a/EntityFramework_LoL/Sources/Entities/Migrations/20230204105739_myFirstMigration.Designer.cs b/EntityFramework_LoL/Sources/Entities/Migrations/20230204105739_myFirstMigration.Designer.cs deleted file mode 100644 index 78252d6..0000000 --- a/EntityFramework_LoL/Sources/Entities/Migrations/20230204105739_myFirstMigration.Designer.cs +++ /dev/null @@ -1,118 +0,0 @@ -// -using Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Entities.Migrations -{ - [DbContext(typeof(ChampionDbContext))] - [Migration("20230204105739_myFirstMigration")] - partial class myFirstMigration - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "7.0.2"); - - modelBuilder.Entity("Entities.ChampionEntity", b => - { - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("Bio") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("TEXT"); - - b.Property("Class") - .HasColumnType("INTEGER"); - - b.Property("Icon") - .HasColumnType("TEXT"); - - b.HasKey("Name"); - - b.ToTable("champions"); - - b.HasData( - new - { - Name = "Dave", - Bio = "Le meilleur Jazzman de France", - Class = 2 - }, - new - { - Name = "Armure", - Bio = "Solide", - Class = 6 - }); - }); - - modelBuilder.Entity("Entities.SkinEntity", b => - { - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("ChampionForeignKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("TEXT"); - - b.Property("Icon") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Price") - .HasColumnType("REAL"); - - b.HasKey("Name"); - - b.HasIndex("ChampionForeignKey"); - - b.ToTable("skins"); - - b.HasData( - new - { - Name = "Dave de glace", - ChampionForeignKey = "Dave", - Description = "Enneigé", - Icon = "aaa", - Price = 7.99f - }, - new - { - Name = "Armure Fullspeed", - ChampionForeignKey = "Armure", - Description = "Deja vu", - Icon = "aaa", - Price = 9.99f - }); - }); - - modelBuilder.Entity("Entities.SkinEntity", b => - { - b.HasOne("Entities.ChampionEntity", "Champion") - .WithMany() - .HasForeignKey("ChampionForeignKey") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Champion"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/EntityFramework_LoL/Sources/Entities/Migrations/20230204105739_myFirstMigration.cs b/EntityFramework_LoL/Sources/Entities/Migrations/20230204105739_myFirstMigration.cs deleted file mode 100644 index a628a29..0000000 --- a/EntityFramework_LoL/Sources/Entities/Migrations/20230204105739_myFirstMigration.cs +++ /dev/null @@ -1,84 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional - -namespace Entities.Migrations -{ - /// - public partial class myFirstMigration : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "champions", - columns: table => new - { - Name = table.Column(type: "TEXT", maxLength: 256, nullable: false), - Bio = table.Column(type: "TEXT", maxLength: 500, nullable: false), - Icon = table.Column(type: "TEXT", nullable: true), - Class = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_champions", x => x.Name); - }); - - migrationBuilder.CreateTable( - name: "skins", - columns: table => new - { - Name = table.Column(type: "TEXT", maxLength: 256, nullable: false), - Description = table.Column(type: "TEXT", maxLength: 500, nullable: false), - Icon = table.Column(type: "TEXT", nullable: false), - Price = table.Column(type: "REAL", nullable: false), - ChampionForeignKey = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_skins", x => x.Name); - table.ForeignKey( - name: "FK_skins_champions_ChampionForeignKey", - column: x => x.ChampionForeignKey, - principalTable: "champions", - principalColumn: "Name", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.InsertData( - table: "champions", - columns: new[] { "Name", "Bio", "Class", "Icon" }, - values: new object[,] - { - { "Armure", "Solide", 6, null }, - { "Dave", "Le meilleur Jazzman de France", 2, null } - }); - - migrationBuilder.InsertData( - table: "skins", - columns: new[] { "Name", "ChampionForeignKey", "Description", "Icon", "Price" }, - values: new object[,] - { - { "Armure Fullspeed", "Armure", "Deja vu", "aaa", 9.99f }, - { "Dave de glace", "Dave", "Enneigé", "aaa", 7.99f } - }); - - migrationBuilder.CreateIndex( - name: "IX_skins_ChampionForeignKey", - table: "skins", - column: "ChampionForeignKey"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "skins"); - - migrationBuilder.DropTable( - name: "champions"); - } - } -} diff --git a/EntityFramework_LoL/Sources/Entities/Migrations/20230208162909_myFirstMigration.Designer.cs b/EntityFramework_LoL/Sources/Entities/Migrations/20230208162909_myFirstMigration.Designer.cs new file mode 100644 index 0000000..130ec85 --- /dev/null +++ b/EntityFramework_LoL/Sources/Entities/Migrations/20230208162909_myFirstMigration.Designer.cs @@ -0,0 +1,268 @@ +// +using System; +using Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Entities.Migrations +{ + [DbContext(typeof(ChampionDbContext))] + [Migration("20230208162909_myFirstMigration")] + partial class myFirstMigration + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.2"); + + modelBuilder.Entity("ChampionEntitySkillEntity", b => + { + b.Property("ChampionsName") + .HasColumnType("TEXT"); + + b.Property("SkillsName") + .HasColumnType("TEXT"); + + b.HasKey("ChampionsName", "SkillsName"); + + b.HasIndex("SkillsName"); + + b.ToTable("ChampionEntitySkillEntity"); + }); + + modelBuilder.Entity("Entities.ChampionEntity", b => + { + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("Bio") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Class") + .HasColumnType("INTEGER"); + + b.Property("Icon") + .HasColumnType("TEXT"); + + b.HasKey("Name"); + + b.ToTable("champions"); + + b.HasData( + new + { + Name = "Dave", + Bio = "Le meilleur Jazzman de France", + Class = 2 + }, + new + { + Name = "Armure", + Bio = "Solide", + Class = 6 + }); + }); + + modelBuilder.Entity("Entities.RuneEntity", b => + { + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("RuneFamily") + .HasColumnType("INTEGER"); + + b.HasKey("Name"); + + b.ToTable("runes"); + + b.HasData( + new + { + Name = "Bullseye", + Description = "Steady shot", + RuneFamily = 1 + }, + new + { + Name = "Alkatraz", + Description = "Lock effect", + RuneFamily = 2 + }); + }); + + modelBuilder.Entity("Entities.RunePageEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("runepages"); + + b.HasData( + new + { + Id = new Guid("78729bae-c931-4a75-9662-6754ed8e2ce3"), + Name = "Runepage_1" + }); + }); + + modelBuilder.Entity("Entities.SkillEntity", b => + { + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("SkillType") + .HasColumnType("INTEGER"); + + b.HasKey("Name"); + + b.ToTable("skills"); + + b.HasData( + new + { + Name = "Boule de feu", + Description = "Fire!", + SkillType = 1 + }, + new + { + Name = "White Star", + Description = "Random damage", + SkillType = 3 + }); + }); + + modelBuilder.Entity("Entities.SkinEntity", b => + { + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("ChampionForeignKey") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("Icon") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Price") + .HasColumnType("REAL"); + + b.HasKey("Name"); + + b.HasIndex("ChampionForeignKey"); + + b.ToTable("skins"); + + b.HasData( + new + { + Name = "Dave de glace", + ChampionForeignKey = "Dave", + Description = "Enneigé", + Icon = "aaa", + Price = 7.99f + }, + new + { + Name = "Armure Fullspeed", + ChampionForeignKey = "Armure", + Description = "Deja vu", + Icon = "aaa", + Price = 9.99f + }); + }); + + modelBuilder.Entity("RuneEntityRunePageEntity", b => + { + b.Property("runepagesId") + .HasColumnType("TEXT"); + + b.Property("runesName") + .HasColumnType("TEXT"); + + b.HasKey("runepagesId", "runesName"); + + b.HasIndex("runesName"); + + b.ToTable("RuneEntityRunePageEntity"); + }); + + modelBuilder.Entity("ChampionEntitySkillEntity", b => + { + b.HasOne("Entities.ChampionEntity", null) + .WithMany() + .HasForeignKey("ChampionsName") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Entities.SkillEntity", null) + .WithMany() + .HasForeignKey("SkillsName") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Entities.SkinEntity", b => + { + b.HasOne("Entities.ChampionEntity", "Champion") + .WithMany() + .HasForeignKey("ChampionForeignKey") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Champion"); + }); + + modelBuilder.Entity("RuneEntityRunePageEntity", b => + { + b.HasOne("Entities.RunePageEntity", null) + .WithMany() + .HasForeignKey("runepagesId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Entities.RuneEntity", null) + .WithMany() + .HasForeignKey("runesName") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/EntityFramework_LoL/Sources/Entities/Migrations/20230208162909_myFirstMigration.cs b/EntityFramework_LoL/Sources/Entities/Migrations/20230208162909_myFirstMigration.cs new file mode 100644 index 0000000..62248a1 --- /dev/null +++ b/EntityFramework_LoL/Sources/Entities/Migrations/20230208162909_myFirstMigration.cs @@ -0,0 +1,219 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace Entities.Migrations +{ + /// + public partial class myFirstMigration : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "champions", + columns: table => new + { + Name = table.Column(type: "TEXT", maxLength: 256, nullable: false), + Bio = table.Column(type: "TEXT", maxLength: 500, nullable: false), + Icon = table.Column(type: "TEXT", nullable: true), + Class = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_champions", x => x.Name); + }); + + migrationBuilder.CreateTable( + name: "runepages", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", maxLength: 256, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_runepages", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "runes", + columns: table => new + { + Name = table.Column(type: "TEXT", maxLength: 256, nullable: false), + Description = table.Column(type: "TEXT", maxLength: 500, nullable: false), + RuneFamily = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_runes", x => x.Name); + }); + + migrationBuilder.CreateTable( + name: "skills", + columns: table => new + { + Name = table.Column(type: "TEXT", maxLength: 256, nullable: false), + Description = table.Column(type: "TEXT", maxLength: 500, nullable: false), + SkillType = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_skills", x => x.Name); + }); + + migrationBuilder.CreateTable( + name: "skins", + columns: table => new + { + Name = table.Column(type: "TEXT", maxLength: 256, nullable: false), + Description = table.Column(type: "TEXT", maxLength: 500, nullable: false), + Icon = table.Column(type: "TEXT", nullable: false), + Price = table.Column(type: "REAL", nullable: false), + ChampionForeignKey = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_skins", x => x.Name); + table.ForeignKey( + name: "FK_skins_champions_ChampionForeignKey", + column: x => x.ChampionForeignKey, + principalTable: "champions", + principalColumn: "Name", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "RuneEntityRunePageEntity", + columns: table => new + { + runepagesId = table.Column(type: "TEXT", nullable: false), + runesName = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_RuneEntityRunePageEntity", x => new { x.runepagesId, x.runesName }); + table.ForeignKey( + name: "FK_RuneEntityRunePageEntity_runepages_runepagesId", + column: x => x.runepagesId, + principalTable: "runepages", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_RuneEntityRunePageEntity_runes_runesName", + column: x => x.runesName, + principalTable: "runes", + principalColumn: "Name", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ChampionEntitySkillEntity", + columns: table => new + { + ChampionsName = table.Column(type: "TEXT", nullable: false), + SkillsName = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ChampionEntitySkillEntity", x => new { x.ChampionsName, x.SkillsName }); + table.ForeignKey( + name: "FK_ChampionEntitySkillEntity_champions_ChampionsName", + column: x => x.ChampionsName, + principalTable: "champions", + principalColumn: "Name", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ChampionEntitySkillEntity_skills_SkillsName", + column: x => x.SkillsName, + principalTable: "skills", + principalColumn: "Name", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.InsertData( + table: "champions", + columns: new[] { "Name", "Bio", "Class", "Icon" }, + values: new object[,] + { + { "Armure", "Solide", 6, null }, + { "Dave", "Le meilleur Jazzman de France", 2, null } + }); + + migrationBuilder.InsertData( + table: "runepages", + columns: new[] { "Id", "Name" }, + values: new object[] { new Guid("78729bae-c931-4a75-9662-6754ed8e2ce3"), "Runepage_1" }); + + migrationBuilder.InsertData( + table: "runes", + columns: new[] { "Name", "Description", "RuneFamily" }, + values: new object[,] + { + { "Alkatraz", "Lock effect", 2 }, + { "Bullseye", "Steady shot", 1 } + }); + + migrationBuilder.InsertData( + table: "skills", + columns: new[] { "Name", "Description", "SkillType" }, + values: new object[,] + { + { "Boule de feu", "Fire!", 1 }, + { "White Star", "Random damage", 3 } + }); + + migrationBuilder.InsertData( + table: "skins", + columns: new[] { "Name", "ChampionForeignKey", "Description", "Icon", "Price" }, + values: new object[,] + { + { "Armure Fullspeed", "Armure", "Deja vu", "aaa", 9.99f }, + { "Dave de glace", "Dave", "Enneigé", "aaa", 7.99f } + }); + + migrationBuilder.CreateIndex( + name: "IX_ChampionEntitySkillEntity_SkillsName", + table: "ChampionEntitySkillEntity", + column: "SkillsName"); + + migrationBuilder.CreateIndex( + name: "IX_RuneEntityRunePageEntity_runesName", + table: "RuneEntityRunePageEntity", + column: "runesName"); + + migrationBuilder.CreateIndex( + name: "IX_skins_ChampionForeignKey", + table: "skins", + column: "ChampionForeignKey"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ChampionEntitySkillEntity"); + + migrationBuilder.DropTable( + name: "RuneEntityRunePageEntity"); + + migrationBuilder.DropTable( + name: "skins"); + + migrationBuilder.DropTable( + name: "skills"); + + migrationBuilder.DropTable( + name: "runepages"); + + migrationBuilder.DropTable( + name: "runes"); + + migrationBuilder.DropTable( + name: "champions"); + } + } +} diff --git a/EntityFramework_LoL/Sources/Entities/Migrations/ChampionDbContextModelSnapshot.cs b/EntityFramework_LoL/Sources/Entities/Migrations/ChampionDbContextModelSnapshot.cs index f17b1cf..7679554 100644 --- a/EntityFramework_LoL/Sources/Entities/Migrations/ChampionDbContextModelSnapshot.cs +++ b/EntityFramework_LoL/Sources/Entities/Migrations/ChampionDbContextModelSnapshot.cs @@ -1,4 +1,5 @@ // +using System; using Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; @@ -16,6 +17,21 @@ namespace Entities.Migrations #pragma warning disable 612, 618 modelBuilder.HasAnnotation("ProductVersion", "7.0.2"); + modelBuilder.Entity("ChampionEntitySkillEntity", b => + { + b.Property("ChampionsName") + .HasColumnType("TEXT"); + + b.Property("SkillsName") + .HasColumnType("TEXT"); + + b.HasKey("ChampionsName", "SkillsName"); + + b.HasIndex("SkillsName"); + + b.ToTable("ChampionEntitySkillEntity"); + }); + modelBuilder.Entity("Entities.ChampionEntity", b => { b.Property("Name") @@ -52,6 +68,95 @@ namespace Entities.Migrations }); }); + modelBuilder.Entity("Entities.RuneEntity", b => + { + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("RuneFamily") + .HasColumnType("INTEGER"); + + b.HasKey("Name"); + + b.ToTable("runes"); + + b.HasData( + new + { + Name = "Bullseye", + Description = "Steady shot", + RuneFamily = 1 + }, + new + { + Name = "Alkatraz", + Description = "Lock effect", + RuneFamily = 2 + }); + }); + + modelBuilder.Entity("Entities.RunePageEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("runepages"); + + b.HasData( + new + { + Id = new Guid("78729bae-c931-4a75-9662-6754ed8e2ce3"), + Name = "Runepage_1" + }); + }); + + modelBuilder.Entity("Entities.SkillEntity", b => + { + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("TEXT"); + + b.Property("SkillType") + .HasColumnType("INTEGER"); + + b.HasKey("Name"); + + b.ToTable("skills"); + + b.HasData( + new + { + Name = "Boule de feu", + Description = "Fire!", + SkillType = 1 + }, + new + { + Name = "White Star", + Description = "Random damage", + SkillType = 3 + }); + }); + modelBuilder.Entity("Entities.SkinEntity", b => { b.Property("Name") @@ -99,6 +204,36 @@ namespace Entities.Migrations }); }); + modelBuilder.Entity("RuneEntityRunePageEntity", b => + { + b.Property("runepagesId") + .HasColumnType("TEXT"); + + b.Property("runesName") + .HasColumnType("TEXT"); + + b.HasKey("runepagesId", "runesName"); + + b.HasIndex("runesName"); + + b.ToTable("RuneEntityRunePageEntity"); + }); + + modelBuilder.Entity("ChampionEntitySkillEntity", b => + { + b.HasOne("Entities.ChampionEntity", null) + .WithMany() + .HasForeignKey("ChampionsName") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Entities.SkillEntity", null) + .WithMany() + .HasForeignKey("SkillsName") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Entities.SkinEntity", b => { b.HasOne("Entities.ChampionEntity", "Champion") @@ -109,6 +244,21 @@ namespace Entities.Migrations b.Navigation("Champion"); }); + + modelBuilder.Entity("RuneEntityRunePageEntity", b => + { + b.HasOne("Entities.RunePageEntity", null) + .WithMany() + .HasForeignKey("runepagesId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Entities.RuneEntity", null) + .WithMany() + .HasForeignKey("runesName") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); #pragma warning restore 612, 618 } } diff --git a/EntityFramework_LoL/Sources/Entities/RuneEntity.cs b/EntityFramework_LoL/Sources/Entities/RuneEntity.cs new file mode 100644 index 0000000..a89d1a4 --- /dev/null +++ b/EntityFramework_LoL/Sources/Entities/RuneEntity.cs @@ -0,0 +1,27 @@ +using Shared; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Entities +{ + public class RuneEntity + { + [Key] + [MaxLength(256)] + public string Name { get; set; } + + [Required] + [MaxLength(500)] + public string Description { get; set; } + + [Required] + public RuneFamily RuneFamily { get; set; } + public ICollection runepages { get; set; } + + + } +} diff --git a/EntityFramework_LoL/Sources/Entities/RunePageEntity.cs b/EntityFramework_LoL/Sources/Entities/RunePageEntity.cs new file mode 100644 index 0000000..ce2ae88 --- /dev/null +++ b/EntityFramework_LoL/Sources/Entities/RunePageEntity.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Entities +{ + public class RunePageEntity + { + + [Key] + public Guid Id { get; set; } + + [MaxLength(256)] + public string Name { get; set; } + + public ICollection runes { get; set; } + + + } +} diff --git a/EntityFramework_LoL/Sources/Entities/SkillEntity.cs b/EntityFramework_LoL/Sources/Entities/SkillEntity.cs new file mode 100644 index 0000000..51a4ffd --- /dev/null +++ b/EntityFramework_LoL/Sources/Entities/SkillEntity.cs @@ -0,0 +1,29 @@ +using Shared; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Entities +{ + public class SkillEntity + { + [Key] + [MaxLength(256)] + public string Name { get; set; } + + [Required] + [MaxLength(500)] + public string Description { get; set; } + + [Required] + public SkillType SkillType { get; set; } + + public virtual ICollection? Champions { get; set; } + + + } +}