push bdd (manque plus que dicos)

rune
Louison PARANT 2 years ago
parent b5d8d82ad7
commit ab8fde8b44

@ -9,7 +9,7 @@ namespace EntityFrameworkLOL.DBContexts
public DbSet<RuneFamilyEntity> RuneFamily { get; set; } public DbSet<RuneFamilyEntity> RuneFamily { get; set; }
public DbSet<ImageEntity> Image { get; set; } public DbSet<ImageEntity> Image { get; set; }
public DbSet<SkillTypeEntity> SkillType { get; set; } public DbSet<SkillTypeEntity> SkillType { get; set; }
//public DbSet<SkillEntity> Skill { get; set; } public DbSet<SkillEntity> Skill { get; set; }
public DbSet<SkinEntity> Skin { get; set; } public DbSet<SkinEntity> Skin { get; set; }
public DbSet<RuneEntity> Rune { get; set; } public DbSet<RuneEntity> Rune { get; set; }
public DbSet<ChampionClassEntity> ChampionClass { get; set; } public DbSet<ChampionClassEntity> ChampionClass { get; set; }
@ -19,6 +19,11 @@ namespace EntityFrameworkLOL.DBContexts
protected override void OnConfiguring(DbContextOptionsBuilder options) protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite($"Data Source=DBLOL.db"); => options.UseSqlite($"Data Source=DBLOL.db");
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
}
public SQLiteContext() public SQLiteContext()
{ } { }

@ -32,6 +32,7 @@ namespace EntityFrameworkLOL.Entities
public ImageEntity Image { get; set; } public ImageEntity Image { get; set; }
//public ICollection<Skill> Skills { get; set; } //[NotMapped]
public virtual ICollection<SkillEntity> Skills { get; set; }
} }
} }

@ -18,7 +18,7 @@ namespace EntityFrameworkLOL.Entities
public SkillTypeEntity Type { get; set; } public SkillTypeEntity Type { get; set; }
[NotMapped] //[NotMapped]
public ICollection<ChampionEntity> Champions { get; set; } public virtual ICollection<ChampionEntity> Champions { get; set; }
} }
} }

@ -14,6 +14,8 @@ namespace EntityFrameworkLOL.Entities
{ {
[Key] [Key]
[ForeignKey("SkillEntity")] [ForeignKey("SkillEntity")]
public int Id { get; set; }
public SkillType Type { get; set; } public SkillType Type { get; set; }
} }
} }

@ -10,8 +10,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace EntityFrameworkLOL.Migrations namespace EntityFrameworkLOL.Migrations
{ {
[DbContext(typeof(SQLiteContext))] [DbContext(typeof(SQLiteContext))]
[Migration("20230208161248_MigrationWallah4")] [Migration("20230209135613_MigrationWallah5")]
partial class MigrationWallah4 partial class MigrationWallah5
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -19,6 +19,21 @@ namespace EntityFrameworkLOL.Migrations
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2"); modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
modelBuilder.Entity("ChampionEntitySkillEntity", b =>
{
b.Property<string>("ChampionsName")
.HasColumnType("TEXT");
b.Property<string>("SkillsName")
.HasColumnType("TEXT");
b.HasKey("ChampionsName", "SkillsName");
b.HasIndex("SkillsName");
b.ToTable("ChampionEntitySkillEntity");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.CategoryEntity", b => modelBuilder.Entity("EntityFrameworkLOL.Entities.CategoryEntity", b =>
{ {
b.Property<int>("Category") b.Property<int>("Category")
@ -130,12 +145,35 @@ namespace EntityFrameworkLOL.Migrations
b.ToTable("RunePage"); b.ToTable("RunePage");
}); });
modelBuilder.Entity("EntityFrameworkLOL.Entities.SkillEntity", b =>
{
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("TypeId")
.HasColumnType("INTEGER");
b.HasKey("Name");
b.HasIndex("TypeId");
b.ToTable("Skill");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.SkillTypeEntity", b => modelBuilder.Entity("EntityFrameworkLOL.Entities.SkillTypeEntity", b =>
{ {
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Type") b.Property<int>("Type")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.HasKey("Type"); b.HasKey("Id");
b.ToTable("SkillType"); b.ToTable("SkillType");
}); });
@ -171,6 +209,21 @@ namespace EntityFrameworkLOL.Migrations
b.ToTable("Skin"); b.ToTable("Skin");
}); });
modelBuilder.Entity("ChampionEntitySkillEntity", b =>
{
b.HasOne("EntityFrameworkLOL.Entities.ChampionEntity", null)
.WithMany()
.HasForeignKey("ChampionsName")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntityFrameworkLOL.Entities.SkillEntity", null)
.WithMany()
.HasForeignKey("SkillsName")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.ChampionEntity", b => modelBuilder.Entity("EntityFrameworkLOL.Entities.ChampionEntity", b =>
{ {
b.HasOne("EntityFrameworkLOL.Entities.ChampionClassEntity", "Class") b.HasOne("EntityFrameworkLOL.Entities.ChampionClassEntity", "Class")
@ -207,6 +260,17 @@ namespace EntityFrameworkLOL.Migrations
b.Navigation("Image"); b.Navigation("Image");
}); });
modelBuilder.Entity("EntityFrameworkLOL.Entities.SkillEntity", b =>
{
b.HasOne("EntityFrameworkLOL.Entities.SkillTypeEntity", "Type")
.WithMany()
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Type");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.SkinEntity", b => modelBuilder.Entity("EntityFrameworkLOL.Entities.SkinEntity", b =>
{ {
b.HasOne("EntityFrameworkLOL.Entities.ChampionEntity", "ChampionSkin") b.HasOne("EntityFrameworkLOL.Entities.ChampionEntity", "ChampionSkin")

@ -5,7 +5,7 @@
namespace EntityFrameworkLOL.Migrations namespace EntityFrameworkLOL.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class MigrationWallah4 : Migration public partial class MigrationWallah5 : Migration
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
@ -73,11 +73,13 @@ namespace EntityFrameworkLOL.Migrations
name: "SkillType", name: "SkillType",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Type = table.Column<int>(type: "INTEGER", nullable: false) Type = table.Column<int>(type: "INTEGER", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_SkillType", x => x.Type); table.PrimaryKey("PK_SkillType", x => x.Id);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
@ -132,6 +134,25 @@ namespace EntityFrameworkLOL.Migrations
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable(
name: "Skill",
columns: table => new
{
Name = table.Column<string>(type: "TEXT", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: false),
TypeId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Skill", x => x.Name);
table.ForeignKey(
name: "FK_Skill_SkillType_TypeId",
column: x => x.TypeId,
principalTable: "SkillType",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Skin", name: "Skin",
columns: table => new columns: table => new
@ -158,6 +179,30 @@ namespace EntityFrameworkLOL.Migrations
principalColumn: "Base64"); principalColumn: "Base64");
}); });
migrationBuilder.CreateTable(
name: "ChampionEntitySkillEntity",
columns: table => new
{
ChampionsName = table.Column<string>(type: "TEXT", nullable: false),
SkillsName = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ChampionEntitySkillEntity", x => new { x.ChampionsName, x.SkillsName });
table.ForeignKey(
name: "FK_ChampionEntitySkillEntity_Champion_ChampionsName",
column: x => x.ChampionsName,
principalTable: "Champion",
principalColumn: "Name",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ChampionEntitySkillEntity_Skill_SkillsName",
column: x => x.SkillsName,
principalTable: "Skill",
principalColumn: "Name",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Champion_ClassId", name: "IX_Champion_ClassId",
table: "Champion", table: "Champion",
@ -168,6 +213,11 @@ namespace EntityFrameworkLOL.Migrations
table: "Champion", table: "Champion",
column: "ImageBase64"); column: "ImageBase64");
migrationBuilder.CreateIndex(
name: "IX_ChampionEntitySkillEntity_SkillsName",
table: "ChampionEntitySkillEntity",
column: "SkillsName");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Rune_FamilyId", name: "IX_Rune_FamilyId",
table: "Rune", table: "Rune",
@ -178,6 +228,11 @@ namespace EntityFrameworkLOL.Migrations
table: "Rune", table: "Rune",
column: "ImageBase64"); column: "ImageBase64");
migrationBuilder.CreateIndex(
name: "IX_Skill_TypeId",
table: "Skill",
column: "TypeId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Skin_ChampionSkinName", name: "IX_Skin_ChampionSkinName",
table: "Skin", table: "Skin",
@ -195,6 +250,9 @@ namespace EntityFrameworkLOL.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Category"); name: "Category");
migrationBuilder.DropTable(
name: "ChampionEntitySkillEntity");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Rune"); name: "Rune");
@ -202,10 +260,10 @@ namespace EntityFrameworkLOL.Migrations
name: "RunePage"); name: "RunePage");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "SkillType"); name: "Skin");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Skin"); name: "Skill");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "RuneFamily"); name: "RuneFamily");
@ -213,6 +271,9 @@ namespace EntityFrameworkLOL.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Champion"); name: "Champion");
migrationBuilder.DropTable(
name: "SkillType");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ChampionClass"); name: "ChampionClass");

@ -16,6 +16,21 @@ namespace EntityFrameworkLOL.Migrations
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2"); modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
modelBuilder.Entity("ChampionEntitySkillEntity", b =>
{
b.Property<string>("ChampionsName")
.HasColumnType("TEXT");
b.Property<string>("SkillsName")
.HasColumnType("TEXT");
b.HasKey("ChampionsName", "SkillsName");
b.HasIndex("SkillsName");
b.ToTable("ChampionEntitySkillEntity");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.CategoryEntity", b => modelBuilder.Entity("EntityFrameworkLOL.Entities.CategoryEntity", b =>
{ {
b.Property<int>("Category") b.Property<int>("Category")
@ -127,12 +142,35 @@ namespace EntityFrameworkLOL.Migrations
b.ToTable("RunePage"); b.ToTable("RunePage");
}); });
modelBuilder.Entity("EntityFrameworkLOL.Entities.SkillEntity", b =>
{
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("TypeId")
.HasColumnType("INTEGER");
b.HasKey("Name");
b.HasIndex("TypeId");
b.ToTable("Skill");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.SkillTypeEntity", b => modelBuilder.Entity("EntityFrameworkLOL.Entities.SkillTypeEntity", b =>
{ {
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Type") b.Property<int>("Type")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.HasKey("Type"); b.HasKey("Id");
b.ToTable("SkillType"); b.ToTable("SkillType");
}); });
@ -168,6 +206,21 @@ namespace EntityFrameworkLOL.Migrations
b.ToTable("Skin"); b.ToTable("Skin");
}); });
modelBuilder.Entity("ChampionEntitySkillEntity", b =>
{
b.HasOne("EntityFrameworkLOL.Entities.ChampionEntity", null)
.WithMany()
.HasForeignKey("ChampionsName")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntityFrameworkLOL.Entities.SkillEntity", null)
.WithMany()
.HasForeignKey("SkillsName")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.ChampionEntity", b => modelBuilder.Entity("EntityFrameworkLOL.Entities.ChampionEntity", b =>
{ {
b.HasOne("EntityFrameworkLOL.Entities.ChampionClassEntity", "Class") b.HasOne("EntityFrameworkLOL.Entities.ChampionClassEntity", "Class")
@ -204,6 +257,17 @@ namespace EntityFrameworkLOL.Migrations
b.Navigation("Image"); b.Navigation("Image");
}); });
modelBuilder.Entity("EntityFrameworkLOL.Entities.SkillEntity", b =>
{
b.HasOne("EntityFrameworkLOL.Entities.SkillTypeEntity", "Type")
.WithMany()
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Type");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.SkinEntity", b => modelBuilder.Entity("EntityFrameworkLOL.Entities.SkinEntity", b =>
{ {
b.HasOne("EntityFrameworkLOL.Entities.ChampionEntity", "ChampionSkin") b.HasOne("EntityFrameworkLOL.Entities.ChampionEntity", "ChampionSkin")

Loading…
Cancel
Save