From 12b0acc1a967d87bd557d1f08715e1a0da0b9851 Mon Sep 17 00:00:00 2001 From: Louison PARANT Date: Wed, 8 Feb 2023 17:17:28 +0100 Subject: [PATCH] push Bdd (sauf dico et skill) --- .../DBContexts/SQLiteContext.cs | 9 +- Sources/EntityFrameworkLOL/DBLOL.db | Bin 45056 -> 98304 bytes .../Entities/CategoryEntity.cs | 24 ++ .../Entities/ChamionClassEntity.cs | 21 ++ .../Entities/ChampionEntity.cs | 20 +- .../Entities/ImageEntity.cs | 24 ++ .../EntityFrameworkLOL/Entities/RuneEntity.cs | 7 +- .../Entities/RuneFamilyEntity.cs | 21 ++ .../Entities/RunePageEntity.cs | 27 +++ .../Entities/SkillEntity.cs | 24 ++ .../Entities/SkillTypeEntity.cs | 19 ++ .../EntityFrameworkLOL/Entities/SkinEntity.cs | 11 +- .../EntityFrameworkLOL.csproj | 4 + ...0230204102144_MigrationWallah3.Designer.cs | 81 ------- .../20230204102144_MigrationWallah3.cs | 69 ------ ...0230208161248_MigrationWallah4.Designer.cs | 227 ++++++++++++++++++ .../20230208161248_MigrationWallah4.cs | 223 +++++++++++++++++ .../Migrations/SQLiteContextModelSnapshot.cs | 170 ++++++++++++- Sources/EntityFrameworkLOL/Program.cs | 38 +-- 19 files changed, 825 insertions(+), 194 deletions(-) create mode 100644 Sources/EntityFrameworkLOL/Entities/CategoryEntity.cs create mode 100644 Sources/EntityFrameworkLOL/Entities/ChamionClassEntity.cs create mode 100644 Sources/EntityFrameworkLOL/Entities/ImageEntity.cs create mode 100644 Sources/EntityFrameworkLOL/Entities/RuneFamilyEntity.cs create mode 100644 Sources/EntityFrameworkLOL/Entities/RunePageEntity.cs create mode 100644 Sources/EntityFrameworkLOL/Entities/SkillEntity.cs create mode 100644 Sources/EntityFrameworkLOL/Entities/SkillTypeEntity.cs delete mode 100644 Sources/EntityFrameworkLOL/Migrations/20230204102144_MigrationWallah3.Designer.cs delete mode 100644 Sources/EntityFrameworkLOL/Migrations/20230204102144_MigrationWallah3.cs create mode 100644 Sources/EntityFrameworkLOL/Migrations/20230208161248_MigrationWallah4.Designer.cs create mode 100644 Sources/EntityFrameworkLOL/Migrations/20230208161248_MigrationWallah4.cs diff --git a/Sources/EntityFrameworkLOL/DBContexts/SQLiteContext.cs b/Sources/EntityFrameworkLOL/DBContexts/SQLiteContext.cs index 511998a..dba6295 100644 --- a/Sources/EntityFrameworkLOL/DBContexts/SQLiteContext.cs +++ b/Sources/EntityFrameworkLOL/DBContexts/SQLiteContext.cs @@ -5,9 +5,16 @@ namespace EntityFrameworkLOL.DBContexts { class SQLiteContext : DbContext { - public DbSet Champion { get; set; } + public DbSet Category { get; set; } + public DbSet RuneFamily { get; set; } + public DbSet Image { get; set; } + public DbSet SkillType { get; set; } + //public DbSet Skill { get; set; } public DbSet Skin { get; set; } public DbSet Rune { get; set; } + public DbSet ChampionClass { get; set; } + public DbSet RunePage { get; set; } + public DbSet Champion { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder options) => options.UseSqlite($"Data Source=DBLOL.db"); diff --git a/Sources/EntityFrameworkLOL/DBLOL.db b/Sources/EntityFrameworkLOL/DBLOL.db index 858361157c2dffac2361045c41627337790772a0..b647dff5e791fe42309bf5c1dfefa58464f9ff91 100644 GIT binary patch literal 98304 zcmeI)O>Y~=8NhL_D3KB+?)oM4x&>UXS)dA&)aF|xr$&m(G?fyPDVbtY`;aoM#5zRu z;)rq)p90x!a_u4Qq2Hk>0u%w-Lx6sTo_Z*H$hjY&$Ik3>NX~LsUKcrd(Laqf_vM+L zXMZ!Z%Uu%MxwqLr={dhVIzH&0IF-b?gkdCp;y8&!Vp~j?#iU*>F*BpAp|7PCH&MtjnesA%c#nr_xGhfYrk@-#P>-mpn|D5{WY%}@K z^@fB#8i zPcB>v-n$CXcRgBLc=SrzzIDYo&8Z!$gPY7=t;-mH&$Pd4L- zS6+6Cywk4VZ#&H`F}=IF>D0EGJMGq5quF-y+Z%3I%{$wz#@)5n181ZD;EiF~JH5f~ zasSbY=wH5F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100644 index 0000000..caa6ded --- /dev/null +++ b/Sources/EntityFrameworkLOL/Entities/CategoryEntity.cs @@ -0,0 +1,24 @@ +using Microsoft.EntityFrameworkCore; +using System; +using System.Linq; +using System.Threading.Tasks; +using System.Collections.Generic; +using System.Text; +using System.ComponentModel.DataAnnotations; +using System.Xml.Linq; +using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations.Schema; +using Model; +using static System.Net.Mime.MediaTypeNames; +using System.Reflection.PortableExecutable; +using System.Security.Claims; + +namespace EntityFrameworkLOL.Entities +{ + class CategoryEntity + { + [Key] + [ForeignKey("RunePageEntity")] + public RunePage.Category Category { get; set; } + } +} \ No newline at end of file diff --git a/Sources/EntityFrameworkLOL/Entities/ChamionClassEntity.cs b/Sources/EntityFrameworkLOL/Entities/ChamionClassEntity.cs new file mode 100644 index 0000000..8a75e0d --- /dev/null +++ b/Sources/EntityFrameworkLOL/Entities/ChamionClassEntity.cs @@ -0,0 +1,21 @@ +using Microsoft.EntityFrameworkCore; +using System; +using System.Linq; +using System.Threading.Tasks; +using System.Collections.Generic; +using System.Text; +using System.ComponentModel.DataAnnotations; +using Model; +using System.ComponentModel.DataAnnotations.Schema; + +namespace EntityFrameworkLOL.Entities +{ + class ChampionClassEntity + { + [Key] + [ForeignKey("ChampionEntity")] + public int Id { get; set; } + + public ChampionClass Class { get; set; } + } +} \ No newline at end of file diff --git a/Sources/EntityFrameworkLOL/Entities/ChampionEntity.cs b/Sources/EntityFrameworkLOL/Entities/ChampionEntity.cs index 925512a..dbf5173 100644 --- a/Sources/EntityFrameworkLOL/Entities/ChampionEntity.cs +++ b/Sources/EntityFrameworkLOL/Entities/ChampionEntity.cs @@ -6,19 +6,31 @@ using System.Collections.Generic; using System.Text; using System.ComponentModel.DataAnnotations; using System.Xml.Linq; +using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations.Schema; +using Model; +using static System.Net.Mime.MediaTypeNames; +using System.Reflection.PortableExecutable; +using System.Security.Claims; namespace EntityFrameworkLOL.Entities { class ChampionEntity { [Key] - public int Id { get; set; } - - [Required] public string Name { get; set; } public string Bio { get; set; } - /*public string Icon { get; set; }*/ + public string Icon { get; set; } + + [NotMapped] + public Dictionary Characteristics { get; set; } + + public ChampionClassEntity Class { get; set; } + + public ImageEntity Image { get; set; } + + //public ICollection Skills { get; set; } } } \ No newline at end of file diff --git a/Sources/EntityFrameworkLOL/Entities/ImageEntity.cs b/Sources/EntityFrameworkLOL/Entities/ImageEntity.cs new file mode 100644 index 0000000..07a6d91 --- /dev/null +++ b/Sources/EntityFrameworkLOL/Entities/ImageEntity.cs @@ -0,0 +1,24 @@ +using Microsoft.EntityFrameworkCore; +using System; +using System.Linq; +using System.Threading.Tasks; +using System.Collections.Generic; +using System.Text; +using System.ComponentModel.DataAnnotations; +using System.Xml.Linq; +using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations.Schema; +using Model; +using static System.Net.Mime.MediaTypeNames; +using System.Reflection.PortableExecutable; +using System.Security.Claims; + +namespace EntityFrameworkLOL.Entities +{ + class ImageEntity + { + [Key] + [ForeignKey("ChampionEntity")] + public string Base64 { get; set; } + } +} \ No newline at end of file diff --git a/Sources/EntityFrameworkLOL/Entities/RuneEntity.cs b/Sources/EntityFrameworkLOL/Entities/RuneEntity.cs index 296a68a..f313cdf 100644 --- a/Sources/EntityFrameworkLOL/Entities/RuneEntity.cs +++ b/Sources/EntityFrameworkLOL/Entities/RuneEntity.cs @@ -11,11 +11,12 @@ namespace EntityFrameworkLOL.Entities class RuneEntity { [Key] - public int Id { get; set; } - - [Required] public string Name { get; set; } public string Description { get; set; } + + public ImageEntity Image { get; set; } + + public RuneFamilyEntity Family { get; set; } } } \ No newline at end of file diff --git a/Sources/EntityFrameworkLOL/Entities/RuneFamilyEntity.cs b/Sources/EntityFrameworkLOL/Entities/RuneFamilyEntity.cs new file mode 100644 index 0000000..c7369ad --- /dev/null +++ b/Sources/EntityFrameworkLOL/Entities/RuneFamilyEntity.cs @@ -0,0 +1,21 @@ +using Microsoft.EntityFrameworkCore; +using System; +using System.Linq; +using System.Threading.Tasks; +using System.Collections.Generic; +using System.Text; +using System.ComponentModel.DataAnnotations; +using Model; +using System.ComponentModel.DataAnnotations.Schema; + +namespace EntityFrameworkLOL.Entities +{ + class RuneFamilyEntity + { + [Key] + [ForeignKey("RuneEntity")] + public int Id { get; set; } + + public RuneFamily Family { get; set; } + } +} \ No newline at end of file diff --git a/Sources/EntityFrameworkLOL/Entities/RunePageEntity.cs b/Sources/EntityFrameworkLOL/Entities/RunePageEntity.cs new file mode 100644 index 0000000..e99dd61 --- /dev/null +++ b/Sources/EntityFrameworkLOL/Entities/RunePageEntity.cs @@ -0,0 +1,27 @@ +using Microsoft.EntityFrameworkCore; +using System; +using System.Linq; +using System.Threading.Tasks; +using System.Collections.Generic; +using System.Text; +using System.ComponentModel.DataAnnotations; +using System.Xml.Linq; +using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations.Schema; +using Model; +using static System.Net.Mime.MediaTypeNames; +using System.Reflection.PortableExecutable; +using System.Security.Claims; + +namespace EntityFrameworkLOL.Entities +{ + class RunePageEntity + { + [Key] + public string Name { get; set; } + + [NotMapped] + public Dictionary Dictionary { get; set; } + // Switch Dictionary to List puis faudra juste mapper la liste en dico + } +} \ No newline at end of file diff --git a/Sources/EntityFrameworkLOL/Entities/SkillEntity.cs b/Sources/EntityFrameworkLOL/Entities/SkillEntity.cs new file mode 100644 index 0000000..dbefb19 --- /dev/null +++ b/Sources/EntityFrameworkLOL/Entities/SkillEntity.cs @@ -0,0 +1,24 @@ +using Microsoft.EntityFrameworkCore; +using System; +using System.Linq; +using System.Threading.Tasks; +using System.Collections.Generic; +using System.Text; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace EntityFrameworkLOL.Entities +{ + class SkillEntity + { + [Key] + public string Name { get; set; } + + public string Description { get; set; } + + public SkillTypeEntity Type { get; set; } + + [NotMapped] + public ICollection Champions { get; set; } + } +} \ No newline at end of file diff --git a/Sources/EntityFrameworkLOL/Entities/SkillTypeEntity.cs b/Sources/EntityFrameworkLOL/Entities/SkillTypeEntity.cs new file mode 100644 index 0000000..b17df20 --- /dev/null +++ b/Sources/EntityFrameworkLOL/Entities/SkillTypeEntity.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore; +using System; +using System.Linq; +using System.Threading.Tasks; +using System.Collections.Generic; +using System.Text; +using System.ComponentModel.DataAnnotations; +using Model; +using System.ComponentModel.DataAnnotations.Schema; + +namespace EntityFrameworkLOL.Entities +{ + class SkillTypeEntity + { + [Key] + [ForeignKey("SkillEntity")] + public SkillType Type { get; set; } + } +} \ No newline at end of file diff --git a/Sources/EntityFrameworkLOL/Entities/SkinEntity.cs b/Sources/EntityFrameworkLOL/Entities/SkinEntity.cs index 67676c7..d14983b 100644 --- a/Sources/EntityFrameworkLOL/Entities/SkinEntity.cs +++ b/Sources/EntityFrameworkLOL/Entities/SkinEntity.cs @@ -11,15 +11,16 @@ namespace EntityFrameworkLOL.Entities class SkinEntity { [Key] - public int Id { get; set; } - - [Required] public string Name { get; set; } public string Description { get; set; } - /*public string Icon { get; set; } + public string Icon { get; set; } + + public float Price { get; set; } + + public ImageEntity Image { get; set; } - public float Price { get; set; }*/ + public ChampionEntity ChampionSkin { get; set; } } } \ No newline at end of file diff --git a/Sources/EntityFrameworkLOL/EntityFrameworkLOL.csproj b/Sources/EntityFrameworkLOL/EntityFrameworkLOL.csproj index bb493f8..9c01959 100644 --- a/Sources/EntityFrameworkLOL/EntityFrameworkLOL.csproj +++ b/Sources/EntityFrameworkLOL/EntityFrameworkLOL.csproj @@ -25,4 +25,8 @@ + + + + \ No newline at end of file diff --git a/Sources/EntityFrameworkLOL/Migrations/20230204102144_MigrationWallah3.Designer.cs b/Sources/EntityFrameworkLOL/Migrations/20230204102144_MigrationWallah3.Designer.cs deleted file mode 100644 index 956d301..0000000 --- a/Sources/EntityFrameworkLOL/Migrations/20230204102144_MigrationWallah3.Designer.cs +++ /dev/null @@ -1,81 +0,0 @@ -// -using EntityFrameworkLOL.DBContexts; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace EntityFrameworkLOL.Migrations -{ - [DbContext(typeof(SQLiteContext))] - [Migration("20230204102144_MigrationWallah3")] - partial class MigrationWallah3 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "7.0.2"); - - modelBuilder.Entity("EntityFrameworkLOL.Entities.ChampionEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bio") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Champion"); - }); - - modelBuilder.Entity("EntityFrameworkLOL.Entities.RuneEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Rune"); - }); - - modelBuilder.Entity("EntityFrameworkLOL.Entities.SkinEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Skin"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Sources/EntityFrameworkLOL/Migrations/20230204102144_MigrationWallah3.cs b/Sources/EntityFrameworkLOL/Migrations/20230204102144_MigrationWallah3.cs deleted file mode 100644 index 49e7a9d..0000000 --- a/Sources/EntityFrameworkLOL/Migrations/20230204102144_MigrationWallah3.cs +++ /dev/null @@ -1,69 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace EntityFrameworkLOL.Migrations -{ - /// - public partial class MigrationWallah3 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Champion", - 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) - }, - constraints: table => - { - table.PrimaryKey("PK_Champion", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Rune", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: false), - Description = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Rune", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Skin", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: false), - Description = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Skin", x => x.Id); - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Champion"); - - migrationBuilder.DropTable( - name: "Rune"); - - migrationBuilder.DropTable( - name: "Skin"); - } - } -} diff --git a/Sources/EntityFrameworkLOL/Migrations/20230208161248_MigrationWallah4.Designer.cs b/Sources/EntityFrameworkLOL/Migrations/20230208161248_MigrationWallah4.Designer.cs new file mode 100644 index 0000000..e79b656 --- /dev/null +++ b/Sources/EntityFrameworkLOL/Migrations/20230208161248_MigrationWallah4.Designer.cs @@ -0,0 +1,227 @@ +// +using EntityFrameworkLOL.DBContexts; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EntityFrameworkLOL.Migrations +{ + [DbContext(typeof(SQLiteContext))] + [Migration("20230208161248_MigrationWallah4")] + partial class MigrationWallah4 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.2"); + + modelBuilder.Entity("EntityFrameworkLOL.Entities.CategoryEntity", b => + { + b.Property("Category") + .HasColumnType("INTEGER"); + + b.HasKey("Category"); + + b.ToTable("Category"); + }); + + modelBuilder.Entity("EntityFrameworkLOL.Entities.ChampionClassEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Class") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("ChampionClass"); + }); + + modelBuilder.Entity("EntityFrameworkLOL.Entities.ChampionEntity", b => + { + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Bio") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ClassId") + .HasColumnType("INTEGER"); + + b.Property("Icon") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ImageBase64") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Name"); + + b.HasIndex("ClassId"); + + b.HasIndex("ImageBase64"); + + b.ToTable("Champion"); + }); + + modelBuilder.Entity("EntityFrameworkLOL.Entities.ImageEntity", b => + { + b.Property("Base64") + .HasColumnType("TEXT"); + + b.HasKey("Base64"); + + b.ToTable("Image"); + }); + + modelBuilder.Entity("EntityFrameworkLOL.Entities.RuneEntity", b => + { + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("FamilyId") + .HasColumnType("INTEGER"); + + b.Property("ImageBase64") + .HasColumnType("TEXT"); + + b.HasKey("Name"); + + b.HasIndex("FamilyId"); + + b.HasIndex("ImageBase64"); + + b.ToTable("Rune"); + }); + + modelBuilder.Entity("EntityFrameworkLOL.Entities.RuneFamilyEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Family") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("RuneFamily"); + }); + + modelBuilder.Entity("EntityFrameworkLOL.Entities.RunePageEntity", b => + { + b.Property("Name") + .HasColumnType("TEXT"); + + b.HasKey("Name"); + + b.ToTable("RunePage"); + }); + + modelBuilder.Entity("EntityFrameworkLOL.Entities.SkillTypeEntity", b => + { + b.Property("Type") + .HasColumnType("INTEGER"); + + b.HasKey("Type"); + + b.ToTable("SkillType"); + }); + + modelBuilder.Entity("EntityFrameworkLOL.Entities.SkinEntity", b => + { + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ChampionSkinName") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Icon") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ImageBase64") + .HasColumnType("TEXT"); + + b.Property("Price") + .HasColumnType("REAL"); + + b.HasKey("Name"); + + b.HasIndex("ChampionSkinName"); + + b.HasIndex("ImageBase64"); + + b.ToTable("Skin"); + }); + + modelBuilder.Entity("EntityFrameworkLOL.Entities.ChampionEntity", b => + { + b.HasOne("EntityFrameworkLOL.Entities.ChampionClassEntity", "Class") + .WithMany() + .HasForeignKey("ClassId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("EntityFrameworkLOL.Entities.ImageEntity", "Image") + .WithMany() + .HasForeignKey("ImageBase64") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Class"); + + b.Navigation("Image"); + }); + + modelBuilder.Entity("EntityFrameworkLOL.Entities.RuneEntity", b => + { + b.HasOne("EntityFrameworkLOL.Entities.RuneFamilyEntity", "Family") + .WithMany() + .HasForeignKey("FamilyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("EntityFrameworkLOL.Entities.ImageEntity", "Image") + .WithMany() + .HasForeignKey("ImageBase64"); + + b.Navigation("Family"); + + b.Navigation("Image"); + }); + + modelBuilder.Entity("EntityFrameworkLOL.Entities.SkinEntity", b => + { + b.HasOne("EntityFrameworkLOL.Entities.ChampionEntity", "ChampionSkin") + .WithMany() + .HasForeignKey("ChampionSkinName"); + + b.HasOne("EntityFrameworkLOL.Entities.ImageEntity", "Image") + .WithMany() + .HasForeignKey("ImageBase64"); + + b.Navigation("ChampionSkin"); + + b.Navigation("Image"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Sources/EntityFrameworkLOL/Migrations/20230208161248_MigrationWallah4.cs b/Sources/EntityFrameworkLOL/Migrations/20230208161248_MigrationWallah4.cs new file mode 100644 index 0000000..2f96331 --- /dev/null +++ b/Sources/EntityFrameworkLOL/Migrations/20230208161248_MigrationWallah4.cs @@ -0,0 +1,223 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EntityFrameworkLOL.Migrations +{ + /// + public partial class MigrationWallah4 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Category", + columns: table => new + { + Category = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Category", x => x.Category); + }); + + migrationBuilder.CreateTable( + name: "ChampionClass", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Class = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ChampionClass", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Image", + columns: table => new + { + Base64 = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Image", x => x.Base64); + }); + + migrationBuilder.CreateTable( + name: "RuneFamily", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Family = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_RuneFamily", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "RunePage", + columns: table => new + { + Name = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_RunePage", x => x.Name); + }); + + migrationBuilder.CreateTable( + name: "SkillType", + columns: table => new + { + Type = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SkillType", x => x.Type); + }); + + migrationBuilder.CreateTable( + name: "Champion", + columns: table => new + { + Name = table.Column(type: "TEXT", nullable: false), + Bio = table.Column(type: "TEXT", nullable: false), + Icon = table.Column(type: "TEXT", nullable: false), + ClassId = table.Column(type: "INTEGER", nullable: false), + ImageBase64 = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Champion", x => x.Name); + table.ForeignKey( + name: "FK_Champion_ChampionClass_ClassId", + column: x => x.ClassId, + principalTable: "ChampionClass", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Champion_Image_ImageBase64", + column: x => x.ImageBase64, + principalTable: "Image", + principalColumn: "Base64", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Rune", + columns: table => new + { + Name = table.Column(type: "TEXT", nullable: false), + Description = table.Column(type: "TEXT", nullable: false), + ImageBase64 = table.Column(type: "TEXT", nullable: true), + FamilyId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Rune", x => x.Name); + table.ForeignKey( + name: "FK_Rune_Image_ImageBase64", + column: x => x.ImageBase64, + principalTable: "Image", + principalColumn: "Base64"); + table.ForeignKey( + name: "FK_Rune_RuneFamily_FamilyId", + column: x => x.FamilyId, + principalTable: "RuneFamily", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Skin", + columns: table => new + { + Name = table.Column(type: "TEXT", nullable: false), + Description = table.Column(type: "TEXT", nullable: false), + Icon = table.Column(type: "TEXT", nullable: false), + Price = table.Column(type: "REAL", nullable: false), + ImageBase64 = table.Column(type: "TEXT", nullable: true), + ChampionSkinName = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Skin", x => x.Name); + table.ForeignKey( + name: "FK_Skin_Champion_ChampionSkinName", + column: x => x.ChampionSkinName, + principalTable: "Champion", + principalColumn: "Name"); + table.ForeignKey( + name: "FK_Skin_Image_ImageBase64", + column: x => x.ImageBase64, + principalTable: "Image", + principalColumn: "Base64"); + }); + + migrationBuilder.CreateIndex( + name: "IX_Champion_ClassId", + table: "Champion", + column: "ClassId"); + + migrationBuilder.CreateIndex( + name: "IX_Champion_ImageBase64", + table: "Champion", + column: "ImageBase64"); + + migrationBuilder.CreateIndex( + name: "IX_Rune_FamilyId", + table: "Rune", + column: "FamilyId"); + + migrationBuilder.CreateIndex( + name: "IX_Rune_ImageBase64", + table: "Rune", + column: "ImageBase64"); + + migrationBuilder.CreateIndex( + name: "IX_Skin_ChampionSkinName", + table: "Skin", + column: "ChampionSkinName"); + + migrationBuilder.CreateIndex( + name: "IX_Skin_ImageBase64", + table: "Skin", + column: "ImageBase64"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Category"); + + migrationBuilder.DropTable( + name: "Rune"); + + migrationBuilder.DropTable( + name: "RunePage"); + + migrationBuilder.DropTable( + name: "SkillType"); + + migrationBuilder.DropTable( + name: "Skin"); + + migrationBuilder.DropTable( + name: "RuneFamily"); + + migrationBuilder.DropTable( + name: "Champion"); + + migrationBuilder.DropTable( + name: "ChampionClass"); + + migrationBuilder.DropTable( + name: "Image"); + } + } +} diff --git a/Sources/EntityFrameworkLOL/Migrations/SQLiteContextModelSnapshot.cs b/Sources/EntityFrameworkLOL/Migrations/SQLiteContextModelSnapshot.cs index 963e51a..85b39a6 100644 --- a/Sources/EntityFrameworkLOL/Migrations/SQLiteContextModelSnapshot.cs +++ b/Sources/EntityFrameworkLOL/Migrations/SQLiteContextModelSnapshot.cs @@ -16,62 +16,208 @@ namespace EntityFrameworkLOL.Migrations #pragma warning disable 612, 618 modelBuilder.HasAnnotation("ProductVersion", "7.0.2"); - modelBuilder.Entity("EntityFrameworkLOL.Entities.ChampionEntity", b => + modelBuilder.Entity("EntityFrameworkLOL.Entities.CategoryEntity", b => + { + b.Property("Category") + .HasColumnType("INTEGER"); + + b.HasKey("Category"); + + b.ToTable("Category"); + }); + + modelBuilder.Entity("EntityFrameworkLOL.Entities.ChampionClassEntity", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("INTEGER"); + b.Property("Class") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("ChampionClass"); + }); + + modelBuilder.Entity("EntityFrameworkLOL.Entities.ChampionEntity", b => + { + b.Property("Name") + .HasColumnType("TEXT"); + b.Property("Bio") .IsRequired() .HasColumnType("TEXT"); - b.Property("Name") + b.Property("ClassId") + .HasColumnType("INTEGER"); + + b.Property("Icon") .IsRequired() .HasColumnType("TEXT"); - b.HasKey("Id"); + b.Property("ImageBase64") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Name"); + + b.HasIndex("ClassId"); + + b.HasIndex("ImageBase64"); b.ToTable("Champion"); }); + modelBuilder.Entity("EntityFrameworkLOL.Entities.ImageEntity", b => + { + b.Property("Base64") + .HasColumnType("TEXT"); + + b.HasKey("Base64"); + + b.ToTable("Image"); + }); + modelBuilder.Entity("EntityFrameworkLOL.Entities.RuneEntity", b => { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + b.Property("Name") + .HasColumnType("TEXT"); b.Property("Description") .IsRequired() .HasColumnType("TEXT"); - b.Property("Name") - .IsRequired() + b.Property("FamilyId") + .HasColumnType("INTEGER"); + + b.Property("ImageBase64") .HasColumnType("TEXT"); - b.HasKey("Id"); + b.HasKey("Name"); + + b.HasIndex("FamilyId"); + + b.HasIndex("ImageBase64"); b.ToTable("Rune"); }); - modelBuilder.Entity("EntityFrameworkLOL.Entities.SkinEntity", b => + modelBuilder.Entity("EntityFrameworkLOL.Entities.RuneFamilyEntity", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("INTEGER"); + b.Property("Family") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("RuneFamily"); + }); + + modelBuilder.Entity("EntityFrameworkLOL.Entities.RunePageEntity", b => + { + b.Property("Name") + .HasColumnType("TEXT"); + + b.HasKey("Name"); + + b.ToTable("RunePage"); + }); + + modelBuilder.Entity("EntityFrameworkLOL.Entities.SkillTypeEntity", b => + { + b.Property("Type") + .HasColumnType("INTEGER"); + + b.HasKey("Type"); + + b.ToTable("SkillType"); + }); + + modelBuilder.Entity("EntityFrameworkLOL.Entities.SkinEntity", b => + { + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ChampionSkinName") + .HasColumnType("TEXT"); + b.Property("Description") .IsRequired() .HasColumnType("TEXT"); - b.Property("Name") + b.Property("Icon") .IsRequired() .HasColumnType("TEXT"); - b.HasKey("Id"); + b.Property("ImageBase64") + .HasColumnType("TEXT"); + + b.Property("Price") + .HasColumnType("REAL"); + + b.HasKey("Name"); + + b.HasIndex("ChampionSkinName"); + + b.HasIndex("ImageBase64"); b.ToTable("Skin"); }); + + modelBuilder.Entity("EntityFrameworkLOL.Entities.ChampionEntity", b => + { + b.HasOne("EntityFrameworkLOL.Entities.ChampionClassEntity", "Class") + .WithMany() + .HasForeignKey("ClassId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("EntityFrameworkLOL.Entities.ImageEntity", "Image") + .WithMany() + .HasForeignKey("ImageBase64") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Class"); + + b.Navigation("Image"); + }); + + modelBuilder.Entity("EntityFrameworkLOL.Entities.RuneEntity", b => + { + b.HasOne("EntityFrameworkLOL.Entities.RuneFamilyEntity", "Family") + .WithMany() + .HasForeignKey("FamilyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("EntityFrameworkLOL.Entities.ImageEntity", "Image") + .WithMany() + .HasForeignKey("ImageBase64"); + + b.Navigation("Family"); + + b.Navigation("Image"); + }); + + modelBuilder.Entity("EntityFrameworkLOL.Entities.SkinEntity", b => + { + b.HasOne("EntityFrameworkLOL.Entities.ChampionEntity", "ChampionSkin") + .WithMany() + .HasForeignKey("ChampionSkinName"); + + b.HasOne("EntityFrameworkLOL.Entities.ImageEntity", "Image") + .WithMany() + .HasForeignKey("ImageBase64"); + + b.Navigation("ChampionSkin"); + + b.Navigation("Image"); + }); #pragma warning restore 612, 618 } } diff --git a/Sources/EntityFrameworkLOL/Program.cs b/Sources/EntityFrameworkLOL/Program.cs index 70babcb..3a99cee 100644 --- a/Sources/EntityFrameworkLOL/Program.cs +++ b/Sources/EntityFrameworkLOL/Program.cs @@ -8,12 +8,12 @@ class Program { static void Main(string[] args) { - /*ChampionEntity akali = new ChampionEntity { Id = 1, Name = "Akali", Bio = "" }; - ChampionEntity aatrox = new ChampionEntity { Id = 2, Name = "Aatrox", Bio = "" }; - ChampionEntity ahri = new ChampionEntity { Id = 3, Name = "Ahri", Bio = "" }; - ChampionEntity bard = new ChampionEntity { Id = 4, Name = "Bard", Bio = "" }; - ChampionEntity alistar = new ChampionEntity { Id = 5, Name = "Alistar", Bio = "" }; - ChampionEntity akshan = new ChampionEntity { Id = 6, Name = "Akshan", Bio = "" }; + ChampionEntity akali = new ChampionEntity { Name = "Akali", Bio = "" }; + ChampionEntity aatrox = new ChampionEntity { Name = "Aatrox", Bio = "" }; + ChampionEntity ahri = new ChampionEntity { Name = "Ahri", Bio = "" }; + ChampionEntity bard = new ChampionEntity { Name = "Bard", Bio = "" }; + ChampionEntity alistar = new ChampionEntity { Name = "Alistar", Bio = "" }; + ChampionEntity akshan = new ChampionEntity { Name = "Akshan", Bio = "" }; using (var context = new ChampionContext()) { @@ -33,12 +33,12 @@ class Program Console.WriteLine($"{aChampion.Name} (with bio : \"{aChampion.Bio}\")"); } - RuneEntity conqueror = new RuneEntity { Id = 1, Name = "Conqueror", Description = "" }; - RuneEntity thriumph = new RuneEntity { Id = 2, Name = "Thriumph", Description = "" }; - RuneEntity alacrity = new RuneEntity { Id = 3, Name = "Legend : Alacrity", Description = "" }; - RuneEntity tenacity = new RuneEntity { Id = 4, Name = "Legend : Tenacity", Description = "" }; - RuneEntity laststand = new RuneEntity { Id = 5, Name = "Last Stand", Description = "" }; - RuneEntity laststand2 = new RuneEntity { Id = 6, Name = "Last Stand 2", Description = "" }; + RuneEntity conqueror = new RuneEntity { Name = "Conqueror", Description = "" }; + RuneEntity thriumph = new RuneEntity { Name = "Thriumph", Description = "" }; + RuneEntity alacrity = new RuneEntity { Name = "Legend : Alacrity", Description = "" }; + RuneEntity tenacity = new RuneEntity { Name = "Legend : Tenacity", Description = "" }; + RuneEntity laststand = new RuneEntity { Name = "Last Stand", Description = "" }; + RuneEntity laststand2 = new RuneEntity { Name = "Last Stand 2", Description = "" }; using (var context = new RuneContext()) { @@ -58,12 +58,12 @@ class Program Console.WriteLine($"{lRune.Name} (with Description : \"{lRune.Description}\")"); } - SkinEntity stinger = new SkinEntity { Id = 1, Name = "Stinger", Description = "" }; - SkinEntity infernal = new SkinEntity { Id = 2, Name = "Infernal", Description = "" }; - SkinEntity allStar = new SkinEntity { Id = 3, Name = "All-Star", Description = "" }; - SkinEntity justicar = new SkinEntity { Id = 4, Name = "Justicar", Description = "" }; - SkinEntity mecha = new SkinEntity { Id = 5, Name = "Mecha", Description = "" }; - SkinEntity seaHunter = new SkinEntity { Id = 6, Name = "Sea Hunter", Description = "" }; + SkinEntity stinger = new SkinEntity { Name = "Stinger", Description = "" }; + SkinEntity infernal = new SkinEntity { Name = "Infernal", Description = "" }; + SkinEntity allStar = new SkinEntity { Name = "All-Star", Description = "" }; + SkinEntity justicar = new SkinEntity { Name = "Justicar", Description = "" }; + SkinEntity mecha = new SkinEntity { Name = "Mecha", Description = "" }; + SkinEntity seaHunter = new SkinEntity { Name = "Sea Hunter", Description = "" }; using (var context = new SkinContext()) { @@ -92,7 +92,7 @@ class Program .SingleOrDefault(s => s.Name.Equals("Infernal")); context.Remove(droid); context.SaveChanges(); - }*/ + } using (var context = new ChampionContext()) {