diff --git a/Sources/ConsoleDbSQLite/Migrations/20230201115946_migration_ConsoleDbSQLite.Designer.cs b/Sources/ConsoleDbSQLite/Migrations/20230201115946_migration_ConsoleDbSQLite.Designer.cs
deleted file mode 100644
index d789e8a..0000000
--- a/Sources/ConsoleDbSQLite/Migrations/20230201115946_migration_ConsoleDbSQLite.Designer.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-
-#nullable disable
-
-namespace ConsoleDbSQLite.Migrations
-{
- [DbContext(typeof(SQLiteLolContext))]
- [Migration("20230201115946_migration_ConsoleDbSQLite")]
- partial class migrationConsoleDbSQLite
- {
- ///
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
-
- modelBuilder.Entity("EntityFrameworkLib.ChampionEntity", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("INTEGER");
-
- b.Property("Bio")
- .IsRequired()
- .HasColumnType("TEXT");
-
- b.Property("Icon")
- .IsRequired()
- .HasColumnType("TEXT");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("TEXT");
-
- b.HasKey("Id");
-
- b.ToTable("Champions");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/Sources/ConsoleDbSQLite/Migrations/20230201115946_migration_ConsoleDbSQLite.cs b/Sources/ConsoleDbSQLite/Migrations/20230201115946_migration_ConsoleDbSQLite.cs
deleted file mode 100644
index 1f2cbe3..0000000
--- a/Sources/ConsoleDbSQLite/Migrations/20230201115946_migration_ConsoleDbSQLite.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace ConsoleDbSQLite.Migrations
-{
- ///
- public partial class migrationConsoleDbSQLite : Migration
- {
- ///
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "Champions",
- columns: table => new
- {
- Id = table.Column(type: "INTEGER", nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- Name = table.Column(type: "TEXT", nullable: false),
- Bio = table.Column(type: "TEXT", nullable: false),
- Icon = table.Column(type: "TEXT", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Champions", x => x.Id);
- });
- }
-
- ///
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "Champions");
- }
- }
-}
diff --git a/Sources/ConsoleDbSQLite/Migrations/20230325152150_AllMigrations.Designer.cs b/Sources/ConsoleDbSQLite/Migrations/20230325152150_AllMigrations.Designer.cs
new file mode 100644
index 0000000..aea1aea
--- /dev/null
+++ b/Sources/ConsoleDbSQLite/Migrations/20230325152150_AllMigrations.Designer.cs
@@ -0,0 +1,332 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace ConsoleDbSQLite.Migrations
+{
+ [DbContext(typeof(SQLiteLolContext))]
+ [Migration("20230325152150_AllMigrations")]
+ partial class AllMigrations
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
+
+ modelBuilder.Entity("ChampionEntityRunePageEntity", b =>
+ {
+ b.Property("ChampionsName")
+ .HasColumnType("TEXT");
+
+ b.Property("RunePagesName")
+ .HasColumnType("TEXT");
+
+ b.HasKey("ChampionsName", "RunePagesName");
+
+ b.HasIndex("RunePagesName");
+
+ b.ToTable("ChampionEntityRunePageEntity");
+ });
+
+ 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("EntityFrameworkLib.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")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("ImageId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Name");
+
+ b.HasIndex("ImageId");
+
+ b.ToTable("Champions");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.CharacteristicEntity", b =>
+ {
+ b.Property("Name")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property("ChampionForeignKey")
+ .HasColumnType("TEXT");
+
+ b.Property("Value")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Name", "ChampionForeignKey");
+
+ b.HasIndex("ChampionForeignKey");
+
+ b.ToTable("Characteristics");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.LargeImageEntity", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("Base64")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.ToTable("t_LargeImage");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.RuneEntity", b =>
+ {
+ b.Property("Name")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(500)
+ .HasColumnType("TEXT");
+
+ b.Property("ImageId")
+ .HasColumnType("INTEGER");
+
+ b.Property("RuneFamily")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Name");
+
+ b.HasIndex("ImageId");
+
+ b.ToTable("Runes");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.RunePageEntity", b =>
+ {
+ b.Property("Name")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Name");
+
+ b.ToTable("RunesPage");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.RunePageRuneEntity", b =>
+ {
+ b.Property("RunePageName")
+ .HasColumnType("TEXT");
+
+ b.Property("RuneName")
+ .HasColumnType("TEXT");
+
+ b.Property("Category")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("RunePageName", "RuneName");
+
+ b.HasIndex("RuneName");
+
+ b.ToTable("RunePageRunes");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.SkillEntity", b =>
+ {
+ b.Property("Name")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(500)
+ .HasColumnType("TEXT");
+
+ b.Property("Type")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Name");
+
+ b.ToTable("Skills");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.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("ImageId")
+ .HasColumnType("INTEGER");
+
+ b.Property("Price")
+ .HasColumnType("REAL");
+
+ b.HasKey("Name");
+
+ b.HasIndex("ChampionForeignKey");
+
+ b.HasIndex("ImageId");
+
+ b.ToTable("Skins");
+ });
+
+ modelBuilder.Entity("ChampionEntityRunePageEntity", b =>
+ {
+ b.HasOne("EntityFrameworkLib.ChampionEntity", null)
+ .WithMany()
+ .HasForeignKey("ChampionsName")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("EntityFrameworkLib.RunePageEntity", null)
+ .WithMany()
+ .HasForeignKey("RunePagesName")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChampionEntitySkillEntity", b =>
+ {
+ b.HasOne("EntityFrameworkLib.ChampionEntity", null)
+ .WithMany()
+ .HasForeignKey("ChampionsName")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("EntityFrameworkLib.SkillEntity", null)
+ .WithMany()
+ .HasForeignKey("SkillsName")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.ChampionEntity", b =>
+ {
+ b.HasOne("EntityFrameworkLib.LargeImageEntity", "Image")
+ .WithMany()
+ .HasForeignKey("ImageId");
+
+ b.Navigation("Image");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.CharacteristicEntity", b =>
+ {
+ b.HasOne("EntityFrameworkLib.ChampionEntity", "Champion")
+ .WithMany("Characteristics")
+ .HasForeignKey("ChampionForeignKey")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Champion");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.RuneEntity", b =>
+ {
+ b.HasOne("EntityFrameworkLib.LargeImageEntity", "Image")
+ .WithMany()
+ .HasForeignKey("ImageId");
+
+ b.Navigation("Image");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.RunePageRuneEntity", b =>
+ {
+ b.HasOne("EntityFrameworkLib.RuneEntity", "Rune")
+ .WithMany("RunePages")
+ .HasForeignKey("RuneName")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("EntityFrameworkLib.RunePageEntity", "RunePage")
+ .WithMany("Runes")
+ .HasForeignKey("RunePageName")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Rune");
+
+ b.Navigation("RunePage");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.SkinEntity", b =>
+ {
+ b.HasOne("EntityFrameworkLib.ChampionEntity", "Champion")
+ .WithMany()
+ .HasForeignKey("ChampionForeignKey")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("EntityFrameworkLib.LargeImageEntity", "Image")
+ .WithMany()
+ .HasForeignKey("ImageId");
+
+ b.Navigation("Champion");
+
+ b.Navigation("Image");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.ChampionEntity", b =>
+ {
+ b.Navigation("Characteristics");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.RuneEntity", b =>
+ {
+ b.Navigation("RunePages");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.RunePageEntity", b =>
+ {
+ b.Navigation("Runes");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Sources/ConsoleDbSQLite/Migrations/20230325152150_AllMigrations.cs b/Sources/ConsoleDbSQLite/Migrations/20230325152150_AllMigrations.cs
new file mode 100644
index 0000000..cca8ffc
--- /dev/null
+++ b/Sources/ConsoleDbSQLite/Migrations/20230325152150_AllMigrations.cs
@@ -0,0 +1,283 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace ConsoleDbSQLite.Migrations
+{
+ ///
+ public partial class AllMigrations : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "RunesPage",
+ columns: table => new
+ {
+ Name = table.Column(type: "TEXT", maxLength: 256, nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_RunesPage", 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),
+ Type = table.Column(type: "INTEGER", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Skills", x => x.Name);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "t_LargeImage",
+ columns: table => new
+ {
+ Id = table.Column(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ Base64 = table.Column(type: "TEXT", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_t_LargeImage", x => x.Id);
+ });
+
+ 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: false),
+ Class = table.Column(type: "INTEGER", nullable: false),
+ ImageId = table.Column(type: "INTEGER", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Champions", x => x.Name);
+ table.ForeignKey(
+ name: "FK_Champions_t_LargeImage_ImageId",
+ column: x => x.ImageId,
+ principalTable: "t_LargeImage",
+ principalColumn: "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),
+ ImageId = table.Column(type: "INTEGER", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Runes", x => x.Name);
+ table.ForeignKey(
+ name: "FK_Runes_t_LargeImage_ImageId",
+ column: x => x.ImageId,
+ principalTable: "t_LargeImage",
+ principalColumn: "Id");
+ });
+
+ migrationBuilder.CreateTable(
+ name: "ChampionEntityRunePageEntity",
+ columns: table => new
+ {
+ ChampionsName = table.Column(type: "TEXT", nullable: false),
+ RunePagesName = table.Column(type: "TEXT", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ChampionEntityRunePageEntity", x => new { x.ChampionsName, x.RunePagesName });
+ table.ForeignKey(
+ name: "FK_ChampionEntityRunePageEntity_Champions_ChampionsName",
+ column: x => x.ChampionsName,
+ principalTable: "Champions",
+ principalColumn: "Name",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_ChampionEntityRunePageEntity_RunesPage_RunePagesName",
+ column: x => x.RunePagesName,
+ principalTable: "RunesPage",
+ 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.CreateTable(
+ name: "Characteristics",
+ columns: table => new
+ {
+ Name = table.Column(type: "TEXT", maxLength: 256, nullable: false),
+ ChampionForeignKey = table.Column(type: "TEXT", nullable: false),
+ Value = table.Column(type: "INTEGER", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Characteristics", x => new { x.Name, x.ChampionForeignKey });
+ table.ForeignKey(
+ name: "FK_Characteristics_Champions_ChampionForeignKey",
+ column: x => x.ChampionForeignKey,
+ principalTable: "Champions",
+ principalColumn: "Name",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ 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),
+ ImageId = table.Column(type: "INTEGER", nullable: true)
+ },
+ 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);
+ table.ForeignKey(
+ name: "FK_Skins_t_LargeImage_ImageId",
+ column: x => x.ImageId,
+ principalTable: "t_LargeImage",
+ principalColumn: "Id");
+ });
+
+ migrationBuilder.CreateTable(
+ name: "RunePageRunes",
+ columns: table => new
+ {
+ RuneName = table.Column(type: "TEXT", nullable: false),
+ RunePageName = table.Column(type: "TEXT", nullable: false),
+ Category = table.Column(type: "INTEGER", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_RunePageRunes", x => new { x.RunePageName, x.RuneName });
+ table.ForeignKey(
+ name: "FK_RunePageRunes_RunesPage_RunePageName",
+ column: x => x.RunePageName,
+ principalTable: "RunesPage",
+ principalColumn: "Name",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_RunePageRunes_Runes_RuneName",
+ column: x => x.RuneName,
+ principalTable: "Runes",
+ principalColumn: "Name",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_ChampionEntityRunePageEntity_RunePagesName",
+ table: "ChampionEntityRunePageEntity",
+ column: "RunePagesName");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_ChampionEntitySkillEntity_SkillsName",
+ table: "ChampionEntitySkillEntity",
+ column: "SkillsName");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Champions_ImageId",
+ table: "Champions",
+ column: "ImageId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Characteristics_ChampionForeignKey",
+ table: "Characteristics",
+ column: "ChampionForeignKey");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_RunePageRunes_RuneName",
+ table: "RunePageRunes",
+ column: "RuneName");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Runes_ImageId",
+ table: "Runes",
+ column: "ImageId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Skins_ChampionForeignKey",
+ table: "Skins",
+ column: "ChampionForeignKey");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Skins_ImageId",
+ table: "Skins",
+ column: "ImageId");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "ChampionEntityRunePageEntity");
+
+ migrationBuilder.DropTable(
+ name: "ChampionEntitySkillEntity");
+
+ migrationBuilder.DropTable(
+ name: "Characteristics");
+
+ migrationBuilder.DropTable(
+ name: "RunePageRunes");
+
+ migrationBuilder.DropTable(
+ name: "Skins");
+
+ migrationBuilder.DropTable(
+ name: "Skills");
+
+ migrationBuilder.DropTable(
+ name: "RunesPage");
+
+ migrationBuilder.DropTable(
+ name: "Runes");
+
+ migrationBuilder.DropTable(
+ name: "Champions");
+
+ migrationBuilder.DropTable(
+ name: "t_LargeImage");
+ }
+ }
+}
diff --git a/Sources/ConsoleDbSQLite/Migrations/SQLiteLolContextModelSnapshot.cs b/Sources/ConsoleDbSQLite/Migrations/SQLiteLolContextModelSnapshot.cs
index a15aaf0..011a467 100644
--- a/Sources/ConsoleDbSQLite/Migrations/SQLiteLolContextModelSnapshot.cs
+++ b/Sources/ConsoleDbSQLite/Migrations/SQLiteLolContextModelSnapshot.cs
@@ -1,4 +1,5 @@
//
+using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
@@ -15,27 +16,312 @@ namespace ConsoleDbSQLite.Migrations
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
+ modelBuilder.Entity("ChampionEntityRunePageEntity", b =>
+ {
+ b.Property("ChampionsName")
+ .HasColumnType("TEXT");
+
+ b.Property("RunePagesName")
+ .HasColumnType("TEXT");
+
+ b.HasKey("ChampionsName", "RunePagesName");
+
+ b.HasIndex("RunePagesName");
+
+ b.ToTable("ChampionEntityRunePageEntity");
+ });
+
+ 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("EntityFrameworkLib.ChampionEntity", b =>
{
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("INTEGER");
+ b.Property("Name")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
b.Property("Bio")
.IsRequired()
+ .HasMaxLength(500)
.HasColumnType("TEXT");
+ b.Property("Class")
+ .HasColumnType("INTEGER");
+
b.Property("Icon")
.IsRequired()
.HasColumnType("TEXT");
+ b.Property("ImageId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Name");
+
+ b.HasIndex("ImageId");
+
+ b.ToTable("Champions");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.CharacteristicEntity", b =>
+ {
b.Property("Name")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property("ChampionForeignKey")
+ .HasColumnType("TEXT");
+
+ b.Property("Value")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Name", "ChampionForeignKey");
+
+ b.HasIndex("ChampionForeignKey");
+
+ b.ToTable("Characteristics");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.LargeImageEntity", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("Base64")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
- b.ToTable("Champions");
+ b.ToTable("t_LargeImage");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.RuneEntity", b =>
+ {
+ b.Property("Name")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(500)
+ .HasColumnType("TEXT");
+
+ b.Property("ImageId")
+ .HasColumnType("INTEGER");
+
+ b.Property("RuneFamily")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Name");
+
+ b.HasIndex("ImageId");
+
+ b.ToTable("Runes");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.RunePageEntity", b =>
+ {
+ b.Property("Name")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Name");
+
+ b.ToTable("RunesPage");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.RunePageRuneEntity", b =>
+ {
+ b.Property("RunePageName")
+ .HasColumnType("TEXT");
+
+ b.Property("RuneName")
+ .HasColumnType("TEXT");
+
+ b.Property("Category")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("RunePageName", "RuneName");
+
+ b.HasIndex("RuneName");
+
+ b.ToTable("RunePageRunes");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.SkillEntity", b =>
+ {
+ b.Property("Name")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(500)
+ .HasColumnType("TEXT");
+
+ b.Property("Type")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Name");
+
+ b.ToTable("Skills");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.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("ImageId")
+ .HasColumnType("INTEGER");
+
+ b.Property("Price")
+ .HasColumnType("REAL");
+
+ b.HasKey("Name");
+
+ b.HasIndex("ChampionForeignKey");
+
+ b.HasIndex("ImageId");
+
+ b.ToTable("Skins");
+ });
+
+ modelBuilder.Entity("ChampionEntityRunePageEntity", b =>
+ {
+ b.HasOne("EntityFrameworkLib.ChampionEntity", null)
+ .WithMany()
+ .HasForeignKey("ChampionsName")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("EntityFrameworkLib.RunePageEntity", null)
+ .WithMany()
+ .HasForeignKey("RunePagesName")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChampionEntitySkillEntity", b =>
+ {
+ b.HasOne("EntityFrameworkLib.ChampionEntity", null)
+ .WithMany()
+ .HasForeignKey("ChampionsName")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("EntityFrameworkLib.SkillEntity", null)
+ .WithMany()
+ .HasForeignKey("SkillsName")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.ChampionEntity", b =>
+ {
+ b.HasOne("EntityFrameworkLib.LargeImageEntity", "Image")
+ .WithMany()
+ .HasForeignKey("ImageId");
+
+ b.Navigation("Image");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.CharacteristicEntity", b =>
+ {
+ b.HasOne("EntityFrameworkLib.ChampionEntity", "Champion")
+ .WithMany("Characteristics")
+ .HasForeignKey("ChampionForeignKey")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Champion");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.RuneEntity", b =>
+ {
+ b.HasOne("EntityFrameworkLib.LargeImageEntity", "Image")
+ .WithMany()
+ .HasForeignKey("ImageId");
+
+ b.Navigation("Image");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.RunePageRuneEntity", b =>
+ {
+ b.HasOne("EntityFrameworkLib.RuneEntity", "Rune")
+ .WithMany("RunePages")
+ .HasForeignKey("RuneName")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("EntityFrameworkLib.RunePageEntity", "RunePage")
+ .WithMany("Runes")
+ .HasForeignKey("RunePageName")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Rune");
+
+ b.Navigation("RunePage");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.SkinEntity", b =>
+ {
+ b.HasOne("EntityFrameworkLib.ChampionEntity", "Champion")
+ .WithMany()
+ .HasForeignKey("ChampionForeignKey")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("EntityFrameworkLib.LargeImageEntity", "Image")
+ .WithMany()
+ .HasForeignKey("ImageId");
+
+ b.Navigation("Champion");
+
+ b.Navigation("Image");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.ChampionEntity", b =>
+ {
+ b.Navigation("Characteristics");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.RuneEntity", b =>
+ {
+ b.Navigation("RunePages");
+ });
+
+ modelBuilder.Entity("EntityFrameworkLib.RunePageEntity", b =>
+ {
+ b.Navigation("Runes");
});
#pragma warning restore 612, 618
}
diff --git a/Sources/ConsoleDbSQLite/Program.cs b/Sources/ConsoleDbSQLite/Program.cs
index 0de637c..a326bb9 100644
--- a/Sources/ConsoleDbSQLite/Program.cs
+++ b/Sources/ConsoleDbSQLite/Program.cs
@@ -3,13 +3,8 @@
using DBEntitiesWithStub;
using EntityFrameworkLib;
using Microsoft.EntityFrameworkCore;
+using System.Net;
-ChampionEntity jax = new ChampionEntity
-{
- Name = "Jax",
- Icon = "icon Jax",
- Bio = "bio Jax"
-};
ChampionEntity darius = new ChampionEntity
{
Name = "Darius",
@@ -43,7 +38,7 @@ using (var context = new SQLiteLolContext())
{
foreach(var n in context.Champions)
{
- Console.WriteLine($"{n.Id} {n.Name}");
+ Console.WriteLine($"{n.Name}");
}
context.SaveChanges();
}
@@ -53,11 +48,39 @@ using (LolContext db = new ChampionsDBEntitiesWithStub())
Console.WriteLine("Contenu de la base :");
foreach(var n in db.Champions)
{
- Console.WriteLine($"\t{n.Id} - {n.Name} - {n.Bio} - {n.Icon}");
+ Console.WriteLine($"\t {n.Name} - {n.Bio} - {n.Icon}");
}
}
- public class SQLiteLolContext : LolContext
+string imageUrl = "https://ddragon.leagueoflegends.com/cdn/img/champion/splash/Jax_0.jpg";
+byte[] imageBytes;
+
+using (WebClient client = new WebClient())
+{
+ imageBytes = client.DownloadData(imageUrl);
+}
+
+string base64Image = Convert.ToBase64String(imageBytes);
+
+LargeImageEntity image = new LargeImageEntity
+{
+ Base64 = base64Image
+};
+
+using (var context = new SQLiteLolContext())
+{
+ ChampionEntity jax = new ChampionEntity
+ {
+ Name = "Jax",
+ Icon = "Icon Jax",
+ Bio = "Saijax Cail-Rynx Icath'un grandit à Icathia, une satrapie de l'empire shurimien. Dès son plus jeune âge, son père lui contait les récits de temps révolus, lorsque leur nation était encore indépendante et fière, avant que l'oppression de Shurima ne vienne les asservir. Il lui parlait des Kohari, les héros protecteurs d'Icathia et du Mage royal. Le Mage royal n'avait pas cédé face à la conquête shurimienne, mais lorsqu'il mourut au combat, ses protecteurs kohari le suivirent à l'aide d'un suicide rituel. L'empereur de Shurima exhiba les corps pourrissants des Kohari à la vue de tous. Le Mage royal, lui, fut empalé au-dessus des portes de la cité, ses os moisissant à l'air libre.",
+ Image = image
+ };
+ context.Add(jax);
+ context.SaveChanges();
+}
+
+public class SQLiteLolContext : LolContext
{
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
diff --git a/Sources/ConsoleDbSQLite/projet.Champions.db b/Sources/ConsoleDbSQLite/projet.Champions.db
index 1b36906..febbebe 100644
Binary files a/Sources/ConsoleDbSQLite/projet.Champions.db and b/Sources/ConsoleDbSQLite/projet.Champions.db differ
diff --git a/Sources/DBEntitiesWithStub/ChampionsDBEntitiesWithStub.cs b/Sources/DBEntitiesWithStub/ChampionsDBEntitiesWithStub.cs
index 0915884..59f93d2 100644
--- a/Sources/DBEntitiesWithStub/ChampionsDBEntitiesWithStub.cs
+++ b/Sources/DBEntitiesWithStub/ChampionsDBEntitiesWithStub.cs
@@ -11,9 +11,9 @@ namespace DBEntitiesWithStub
base.OnModelCreating(modelBuilder);
modelBuilder.Entity().HasData(
- new ChampionEntity { Id = 1, Name = "Yone", Bio = "Bio de Yone", Icon = "Icon de Yone" },
- new ChampionEntity { Id = 2, Name = "Akali", Bio = "Bio de Akali", Icon = "Icon de Akali" },
- new ChampionEntity { Id = 3, Name = "Bard", Bio = "Bio de Bard", Icon = "Icon de Bard" }
+ new ChampionEntity { Name = "Yone", Bio = "Bio de Yone", Icon = "Icon de Yone" },
+ new ChampionEntity { Name = "Akali", Bio = "Bio de Akali", Icon = "Icon de Akali" },
+ new ChampionEntity { Name = "Bard", Bio = "Bio de Bard", Icon = "Icon de Bard" }
);
}
}
diff --git a/Sources/EntityFrameworkLib/ChampionEntity.cs b/Sources/EntityFrameworkLib/ChampionEntity.cs
index d05b33e..28c778e 100644
--- a/Sources/EntityFrameworkLib/ChampionEntity.cs
+++ b/Sources/EntityFrameworkLib/ChampionEntity.cs
@@ -21,9 +21,10 @@ namespace EntityFrameworkLib
public string Icon { get; set; }
[Required]
public ChampionClass Class { get; set; }
- public ICollection Skills { get; set; }
- public ICollection Characteristics { get; set; }
- public ICollection RunePages { get; set; }
+ public ICollection? Skills { get; set; }
+ public ICollection? Skins { get; set; }
+ public ICollection? Characteristics { get; set; }
+ public ICollection? RunePages { get; set; }
public int? ImageId { get; set; }
[ForeignKey("ImageId")]
diff --git a/Sources/EntityFrameworkLib/LargeImageEntity.cs b/Sources/EntityFrameworkLib/LargeImageEntity.cs
index e4ad130..c7c5f8d 100644
--- a/Sources/EntityFrameworkLib/LargeImageEntity.cs
+++ b/Sources/EntityFrameworkLib/LargeImageEntity.cs
@@ -16,5 +16,7 @@ namespace EntityFrameworkLib
public int Id { get; set; }
[Required]
public string Base64 { get; set; }
+ public ChampionEntity Champion { get; set; }
+ public SkinEntity Skin { get; set; }
}
}
diff --git a/Sources/EntityFrameworkLib/LolContext.cs b/Sources/EntityFrameworkLib/LolContext.cs
index 1d9510f..a0e47df 100644
--- a/Sources/EntityFrameworkLib/LolContext.cs
+++ b/Sources/EntityFrameworkLib/LolContext.cs
@@ -35,6 +35,26 @@ namespace EntityFrameworkLib
modelBuilder.Entity().HasKey(c => new { c.Name, c.ChampionForeignKey });
modelBuilder.Entity().HasKey(c => new { c.RunePageName, c.RuneName });
+ //Relation one-to-one entre un champion et une largeImage : un champion n'a qu'une seule largeImage et une largeImage ne peut être attribuée qu'à un seul champion
+ modelBuilder.Entity()
+ .HasOne(c => c.Image)
+ .WithOne(i => i.Champion)
+ .HasForeignKey(c => c.ImageId);
+
+ //Relation one-to-one : un skin n'a qu'une image et chaque image n'appartient qu'à un seul skin
+ modelBuilder.Entity()
+ .HasOne(s => s.Image)
+ .WithOne(i => i.Skin)
+ .HasForeignKey(s => s.ImageId);
+
+ //Relation one-to-many : un champion a plusieurs skins mais chaque skin ne peut appartenir qu'à un seul champion
+ modelBuilder.Entity()
+ .HasMany(c => c.Skins)
+ .WithOne(s => s.Champion)
+ .HasForeignKey(s => s.ChampionForeignKey);
+
+
+ //Relation many-to-many entre les champions et pages de runes : Un Champion peut avoir plusieurs pages de runes et plusieurs pages de runes peuvent être définies sur un champion
modelBuilder.Entity()
.HasMany(c => c.RunePages)
.WithMany(r => r.Champions);
diff --git a/Sources/EntityFrameworkLib/RuneEntity.cs b/Sources/EntityFrameworkLib/RuneEntity.cs
index aa31b65..638e107 100644
--- a/Sources/EntityFrameworkLib/RuneEntity.cs
+++ b/Sources/EntityFrameworkLib/RuneEntity.cs
@@ -17,6 +17,7 @@ namespace EntityFrameworkLib
[Required]
[MaxLength(500)]
public string Description { get; set; }
+
[Required]
public RuneFamily RuneFamily { get; set; }
public ICollection? RunePages { get; set; }