master
Jolys Enzo 2 years ago
parent 3cd2ab54b5
commit 61d51bc45d

@ -62,11 +62,46 @@ namespace EntityFramwork
modelBuilder.Entity<EntityRunes>().HasKey(c => c.Id);
modelBuilder.Entity<EntityRunes>().Property(c => c.Id)
.ValueGeneratedOnAdd();
modelBuilder.Entity<EntityRunes>().HasMany(e => e.CategorieRune)
.WithOne(e => e.Rune)
.HasForeignKey(e => e.IdRune);
// -------------------------------------------------------------------------------//
//création de la table Skills
modelBuilder.Entity<EntitySkill>().HasKey(c => c.Id);
modelBuilder.Entity<EntitySkill>().Property(c => c.Id)
.ValueGeneratedOnAdd();
// -------------------------------------------------------------------------------//
//création de la table Page rune
modelBuilder.Entity<EntityPageRune>().HasKey(c => c.Id);
modelBuilder.Entity<EntityPageRune>().Property(c => c.Id)
.ValueGeneratedOnAdd();
modelBuilder.Entity<EntityPageRune>().HasMany(e => e.CategorieRune)
.WithOne(e => e.PageRune)
.HasForeignKey(e => e.IdPageRune);
// -------------------------------------------------------------------------------//
//création de la table Categorie_Rune
modelBuilder.Entity<EntityCategorieRune>().HasKey(c => c.Id);
modelBuilder.Entity<EntityCategorieRune>().Property(c => c.Id)
.ValueGeneratedOnAdd();
// ---------------------------------- Stub --------------------------------------//
// Ajout Image
int nbImage = 29;
List<EntityLargeImage> listImage = new List<EntityLargeImage>();
for( int i=1; i<nbImage+1; i++)
{
EntityLargeImage tmpImage = new EntityLargeImage() { Id = i,Base64 = "Inconnu !" };
listImage.Add(tmpImage);
}
modelBuilder.Entity<EntityLargeImage>().HasData(listImage);
// Ajout Champion
}
public DbSet<EntityChampions> Champions { get; set; }
@ -74,12 +109,14 @@ namespace EntityFramwork
public DbSet<EntityLargeImage> Images { get; set; }
public DbSet<EntityRunes> Runes { get; set; }
public DbSet<EntitySkill> Skills { get; set; }
public DbSet<EntityPageRune> PageRunes { get; set; }
public DbSet<EntityCategorieRune> CategorieRunes { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
optionsBuilder.UseSqlite($"Data Source=C:\\Users\\Jolys Enzo\\home\\BUT\\Projet\\LOL-API\\Sources\\EntityFramwork\\BDD-APILOL.db");
optionsBuilder.UseSqlite($"Data Source=BDD-APILOL.db");
}
}
}

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EntityFramwork
{
public class EntityCategorieRune
{
public int Id { get; set; }
public string Category { get; set; }
// Relation Page rune
public int IdPageRune { get; set;}
public EntityPageRune PageRune { get; set; }
// Relation Rune
public int IdRune { get; set;}
public EntityRunes Rune { get; set; }
}
}

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EntityFramwork
{
public class EntityPageRune
{
public int Id { get; set; }
public string Name { get; set; }
// Relation
public List<EntityCategorieRune> CategorieRune { get; set;
}
}
}

@ -18,5 +18,9 @@ namespace EntityFramwork
// --------- Images ---------- //
public int ImageId { get; set; }
public EntityLargeImage Image { get; set; }
// -------- CategorieRune --------//
public List<EntityCategorieRune> CategorieRune { get; set; }
}
}

@ -0,0 +1,309 @@
// <auto-generated />
using EntityFramwork;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace EntityFramwork.Migrations
{
[DbContext(typeof(BDDContext))]
[Migration("20230222130004_final")]
partial class final
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
modelBuilder.Entity("DTO.EntityChampions", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Bio")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Classe")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("ImageId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("ImageId")
.IsUnique();
b.HasIndex("Name")
.IsUnique();
b.ToTable("Champions");
});
modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Category")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("IdPageRune")
.HasColumnType("INTEGER");
b.Property<int>("IdRune")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("IdPageRune");
b.HasIndex("IdRune");
b.ToTable("EntityCategorieRune");
});
modelBuilder.Entity("EntityFramwork.EntityLargeImage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Base64")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Images");
});
modelBuilder.Entity("EntityFramwork.EntityPageRune", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("EntityPageRune");
});
modelBuilder.Entity("EntityFramwork.EntityRunes", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Family")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("ImageId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("ImageId")
.IsUnique();
b.ToTable("Runes");
});
modelBuilder.Entity("EntityFramwork.EntitySkill", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("ChampionId")
.HasColumnType("INTEGER");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("ChampionId");
b.ToTable("Skills");
});
modelBuilder.Entity("EntityFramwork.EntitySkins", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("ChampionId")
.HasColumnType("INTEGER");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("ImageId")
.HasColumnType("INTEGER");
b.Property<float>("Price")
.HasColumnType("REAL");
b.HasKey("Id");
b.HasIndex("ChampionId");
b.HasIndex("ImageId")
.IsUnique();
b.ToTable("Skins");
});
modelBuilder.Entity("DTO.EntityChampions", b =>
{
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
.WithOne("Champion")
.HasForeignKey("DTO.EntityChampions", "ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Image");
});
modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{
b.HasOne("EntityFramwork.EntityPageRune", "PageRune")
.WithMany("CategorieRune")
.HasForeignKey("IdPageRune")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntityFramwork.EntityRunes", "Rune")
.WithMany("CategorieRune")
.HasForeignKey("IdRune")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("PageRune");
b.Navigation("Rune");
});
modelBuilder.Entity("EntityFramwork.EntityRunes", b =>
{
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
.WithOne("Rune")
.HasForeignKey("EntityFramwork.EntityRunes", "ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Image");
});
modelBuilder.Entity("EntityFramwork.EntitySkill", b =>
{
b.HasOne("DTO.EntityChampions", "Champions")
.WithMany("Skills")
.HasForeignKey("ChampionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Champions");
});
modelBuilder.Entity("EntityFramwork.EntitySkins", b =>
{
b.HasOne("DTO.EntityChampions", "Champion")
.WithMany("Skins")
.HasForeignKey("ChampionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
.WithOne("Skin")
.HasForeignKey("EntityFramwork.EntitySkins", "ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Champion");
b.Navigation("Image");
});
modelBuilder.Entity("DTO.EntityChampions", b =>
{
b.Navigation("Skills");
b.Navigation("Skins");
});
modelBuilder.Entity("EntityFramwork.EntityLargeImage", b =>
{
b.Navigation("Champion")
.IsRequired();
b.Navigation("Rune")
.IsRequired();
b.Navigation("Skin")
.IsRequired();
});
modelBuilder.Entity("EntityFramwork.EntityPageRune", b =>
{
b.Navigation("CategorieRune");
});
modelBuilder.Entity("EntityFramwork.EntityRunes", b =>
{
b.Navigation("CategorieRune");
});
#pragma warning restore 612, 618
}
}
}

@ -0,0 +1,170 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntityFramwork.Migrations
{
/// <inheritdoc />
public partial class final : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Skins_Champions_ChampionForeignKey",
table: "Skins");
migrationBuilder.RenameColumn(
name: "ChampionForeignKey",
table: "Skins",
newName: "ChampionId");
migrationBuilder.RenameIndex(
name: "IX_Skins_ChampionForeignKey",
table: "Skins",
newName: "IX_Skins_ChampionId");
migrationBuilder.AddColumn<string>(
name: "Family",
table: "Runes",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "Classe",
table: "Champions",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.CreateTable(
name: "EntityPageRune",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EntityPageRune", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Skills",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: false),
Type = table.Column<string>(type: "TEXT", nullable: false),
ChampionId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Skills", x => x.Id);
table.ForeignKey(
name: "FK_Skills_Champions_ChampionId",
column: x => x.ChampionId,
principalTable: "Champions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "EntityCategorieRune",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Category = table.Column<string>(type: "TEXT", nullable: false),
IdPageRune = table.Column<int>(type: "INTEGER", nullable: false),
IdRune = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EntityCategorieRune", x => x.Id);
table.ForeignKey(
name: "FK_EntityCategorieRune_EntityPageRune_IdPageRune",
column: x => x.IdPageRune,
principalTable: "EntityPageRune",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_EntityCategorieRune_Runes_IdRune",
column: x => x.IdRune,
principalTable: "Runes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_EntityCategorieRune_IdPageRune",
table: "EntityCategorieRune",
column: "IdPageRune");
migrationBuilder.CreateIndex(
name: "IX_EntityCategorieRune_IdRune",
table: "EntityCategorieRune",
column: "IdRune");
migrationBuilder.CreateIndex(
name: "IX_Skills_ChampionId",
table: "Skills",
column: "ChampionId");
migrationBuilder.AddForeignKey(
name: "FK_Skins_Champions_ChampionId",
table: "Skins",
column: "ChampionId",
principalTable: "Champions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Skins_Champions_ChampionId",
table: "Skins");
migrationBuilder.DropTable(
name: "EntityCategorieRune");
migrationBuilder.DropTable(
name: "Skills");
migrationBuilder.DropTable(
name: "EntityPageRune");
migrationBuilder.DropColumn(
name: "Family",
table: "Runes");
migrationBuilder.DropColumn(
name: "Classe",
table: "Champions");
migrationBuilder.RenameColumn(
name: "ChampionId",
table: "Skins",
newName: "ChampionForeignKey");
migrationBuilder.RenameIndex(
name: "IX_Skins_ChampionId",
table: "Skins",
newName: "IX_Skins_ChampionForeignKey");
migrationBuilder.AddForeignKey(
name: "FK_Skins_Champions_ChampionForeignKey",
table: "Skins",
column: "ChampionForeignKey",
principalTable: "Champions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

@ -0,0 +1,309 @@
// <auto-generated />
using EntityFramwork;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace EntityFramwork.Migrations
{
[DbContext(typeof(BDDContext))]
[Migration("20230222130958_final2")]
partial class final2
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
modelBuilder.Entity("DTO.EntityChampions", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Bio")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Classe")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("ImageId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("ImageId")
.IsUnique();
b.HasIndex("Name")
.IsUnique();
b.ToTable("Champions");
});
modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Category")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("IdPageRune")
.HasColumnType("INTEGER");
b.Property<int>("IdRune")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("IdPageRune");
b.HasIndex("IdRune");
b.ToTable("EntityCategorieRune");
});
modelBuilder.Entity("EntityFramwork.EntityLargeImage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Base64")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Images");
});
modelBuilder.Entity("EntityFramwork.EntityPageRune", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("EntityPageRune");
});
modelBuilder.Entity("EntityFramwork.EntityRunes", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Family")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("ImageId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("ImageId")
.IsUnique();
b.ToTable("Runes");
});
modelBuilder.Entity("EntityFramwork.EntitySkill", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("ChampionId")
.HasColumnType("INTEGER");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("ChampionId");
b.ToTable("Skills");
});
modelBuilder.Entity("EntityFramwork.EntitySkins", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("ChampionId")
.HasColumnType("INTEGER");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("ImageId")
.HasColumnType("INTEGER");
b.Property<float>("Price")
.HasColumnType("REAL");
b.HasKey("Id");
b.HasIndex("ChampionId");
b.HasIndex("ImageId")
.IsUnique();
b.ToTable("Skins");
});
modelBuilder.Entity("DTO.EntityChampions", b =>
{
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
.WithOne("Champion")
.HasForeignKey("DTO.EntityChampions", "ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Image");
});
modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{
b.HasOne("EntityFramwork.EntityPageRune", "PageRune")
.WithMany("CategorieRune")
.HasForeignKey("IdPageRune")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntityFramwork.EntityRunes", "Rune")
.WithMany("CategorieRune")
.HasForeignKey("IdRune")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("PageRune");
b.Navigation("Rune");
});
modelBuilder.Entity("EntityFramwork.EntityRunes", b =>
{
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
.WithOne("Rune")
.HasForeignKey("EntityFramwork.EntityRunes", "ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Image");
});
modelBuilder.Entity("EntityFramwork.EntitySkill", b =>
{
b.HasOne("DTO.EntityChampions", "Champions")
.WithMany("Skills")
.HasForeignKey("ChampionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Champions");
});
modelBuilder.Entity("EntityFramwork.EntitySkins", b =>
{
b.HasOne("DTO.EntityChampions", "Champion")
.WithMany("Skins")
.HasForeignKey("ChampionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
.WithOne("Skin")
.HasForeignKey("EntityFramwork.EntitySkins", "ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Champion");
b.Navigation("Image");
});
modelBuilder.Entity("DTO.EntityChampions", b =>
{
b.Navigation("Skills");
b.Navigation("Skins");
});
modelBuilder.Entity("EntityFramwork.EntityLargeImage", b =>
{
b.Navigation("Champion")
.IsRequired();
b.Navigation("Rune")
.IsRequired();
b.Navigation("Skin")
.IsRequired();
});
modelBuilder.Entity("EntityFramwork.EntityPageRune", b =>
{
b.Navigation("CategorieRune");
});
modelBuilder.Entity("EntityFramwork.EntityRunes", b =>
{
b.Navigation("CategorieRune");
});
#pragma warning restore 612, 618
}
}
}

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntityFramwork.Migrations
{
/// <inheritdoc />
public partial class final2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

@ -0,0 +1,456 @@
// <auto-generated />
using EntityFramwork;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace EntityFramwork.Migrations
{
[DbContext(typeof(BDDContext))]
[Migration("20230222141822_testModel")]
partial class testModel
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
modelBuilder.Entity("DTO.EntityChampions", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Bio")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Classe")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("ImageId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("ImageId")
.IsUnique();
b.HasIndex("Name")
.IsUnique();
b.ToTable("Champions");
});
modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Category")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("IdPageRune")
.HasColumnType("INTEGER");
b.Property<int>("IdRune")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("IdPageRune");
b.HasIndex("IdRune");
b.ToTable("CategorieRunes");
});
modelBuilder.Entity("EntityFramwork.EntityLargeImage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Base64")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Images");
b.HasData(
new
{
Id = 1,
Base64 = "Inconnu !"
},
new
{
Id = 2,
Base64 = "Inconnu !"
},
new
{
Id = 3,
Base64 = "Inconnu !"
},
new
{
Id = 4,
Base64 = "Inconnu !"
},
new
{
Id = 5,
Base64 = "Inconnu !"
},
new
{
Id = 6,
Base64 = "Inconnu !"
},
new
{
Id = 7,
Base64 = "Inconnu !"
},
new
{
Id = 8,
Base64 = "Inconnu !"
},
new
{
Id = 9,
Base64 = "Inconnu !"
},
new
{
Id = 10,
Base64 = "Inconnu !"
},
new
{
Id = 11,
Base64 = "Inconnu !"
},
new
{
Id = 12,
Base64 = "Inconnu !"
},
new
{
Id = 13,
Base64 = "Inconnu !"
},
new
{
Id = 14,
Base64 = "Inconnu !"
},
new
{
Id = 15,
Base64 = "Inconnu !"
},
new
{
Id = 16,
Base64 = "Inconnu !"
},
new
{
Id = 17,
Base64 = "Inconnu !"
},
new
{
Id = 18,
Base64 = "Inconnu !"
},
new
{
Id = 19,
Base64 = "Inconnu !"
},
new
{
Id = 20,
Base64 = "Inconnu !"
},
new
{
Id = 21,
Base64 = "Inconnu !"
},
new
{
Id = 22,
Base64 = "Inconnu !"
},
new
{
Id = 23,
Base64 = "Inconnu !"
},
new
{
Id = 24,
Base64 = "Inconnu !"
},
new
{
Id = 25,
Base64 = "Inconnu !"
},
new
{
Id = 26,
Base64 = "Inconnu !"
},
new
{
Id = 27,
Base64 = "Inconnu !"
},
new
{
Id = 28,
Base64 = "Inconnu !"
},
new
{
Id = 29,
Base64 = "Inconnu !"
});
});
modelBuilder.Entity("EntityFramwork.EntityPageRune", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("PageRunes");
});
modelBuilder.Entity("EntityFramwork.EntityRunes", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Family")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("ImageId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("ImageId")
.IsUnique();
b.ToTable("Runes");
});
modelBuilder.Entity("EntityFramwork.EntitySkill", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("ChampionId")
.HasColumnType("INTEGER");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("ChampionId");
b.ToTable("Skills");
});
modelBuilder.Entity("EntityFramwork.EntitySkins", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("ChampionId")
.HasColumnType("INTEGER");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("ImageId")
.HasColumnType("INTEGER");
b.Property<float>("Price")
.HasColumnType("REAL");
b.HasKey("Id");
b.HasIndex("ChampionId");
b.HasIndex("ImageId")
.IsUnique();
b.ToTable("Skins");
});
modelBuilder.Entity("DTO.EntityChampions", b =>
{
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
.WithOne("Champion")
.HasForeignKey("DTO.EntityChampions", "ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Image");
});
modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{
b.HasOne("EntityFramwork.EntityPageRune", "PageRune")
.WithMany("CategorieRune")
.HasForeignKey("IdPageRune")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntityFramwork.EntityRunes", "Rune")
.WithMany("CategorieRune")
.HasForeignKey("IdRune")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("PageRune");
b.Navigation("Rune");
});
modelBuilder.Entity("EntityFramwork.EntityRunes", b =>
{
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
.WithOne("Rune")
.HasForeignKey("EntityFramwork.EntityRunes", "ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Image");
});
modelBuilder.Entity("EntityFramwork.EntitySkill", b =>
{
b.HasOne("DTO.EntityChampions", "Champions")
.WithMany("Skills")
.HasForeignKey("ChampionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Champions");
});
modelBuilder.Entity("EntityFramwork.EntitySkins", b =>
{
b.HasOne("DTO.EntityChampions", "Champion")
.WithMany("Skins")
.HasForeignKey("ChampionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
.WithOne("Skin")
.HasForeignKey("EntityFramwork.EntitySkins", "ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Champion");
b.Navigation("Image");
});
modelBuilder.Entity("DTO.EntityChampions", b =>
{
b.Navigation("Skills");
b.Navigation("Skins");
});
modelBuilder.Entity("EntityFramwork.EntityLargeImage", b =>
{
b.Navigation("Champion")
.IsRequired();
b.Navigation("Rune")
.IsRequired();
b.Navigation("Skin")
.IsRequired();
});
modelBuilder.Entity("EntityFramwork.EntityPageRune", b =>
{
b.Navigation("CategorieRune");
});
modelBuilder.Entity("EntityFramwork.EntityRunes", b =>
{
b.Navigation("CategorieRune");
});
#pragma warning restore 612, 618
}
}
}

@ -0,0 +1,321 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace EntityFramwork.Migrations
{
/// <inheritdoc />
public partial class testModel : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_EntityCategorieRune_EntityPageRune_IdPageRune",
table: "EntityCategorieRune");
migrationBuilder.DropForeignKey(
name: "FK_EntityCategorieRune_Runes_IdRune",
table: "EntityCategorieRune");
migrationBuilder.DropPrimaryKey(
name: "PK_EntityPageRune",
table: "EntityPageRune");
migrationBuilder.DropPrimaryKey(
name: "PK_EntityCategorieRune",
table: "EntityCategorieRune");
migrationBuilder.RenameTable(
name: "EntityPageRune",
newName: "PageRunes");
migrationBuilder.RenameTable(
name: "EntityCategorieRune",
newName: "CategorieRunes");
migrationBuilder.RenameIndex(
name: "IX_EntityCategorieRune_IdRune",
table: "CategorieRunes",
newName: "IX_CategorieRunes_IdRune");
migrationBuilder.RenameIndex(
name: "IX_EntityCategorieRune_IdPageRune",
table: "CategorieRunes",
newName: "IX_CategorieRunes_IdPageRune");
migrationBuilder.AddPrimaryKey(
name: "PK_PageRunes",
table: "PageRunes",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_CategorieRunes",
table: "CategorieRunes",
column: "Id");
migrationBuilder.InsertData(
table: "Images",
columns: new[] { "Id", "Base64" },
values: new object[,]
{
{ 1, "Inconnu !" },
{ 2, "Inconnu !" },
{ 3, "Inconnu !" },
{ 4, "Inconnu !" },
{ 5, "Inconnu !" },
{ 6, "Inconnu !" },
{ 7, "Inconnu !" },
{ 8, "Inconnu !" },
{ 9, "Inconnu !" },
{ 10, "Inconnu !" },
{ 11, "Inconnu !" },
{ 12, "Inconnu !" },
{ 13, "Inconnu !" },
{ 14, "Inconnu !" },
{ 15, "Inconnu !" },
{ 16, "Inconnu !" },
{ 17, "Inconnu !" },
{ 18, "Inconnu !" },
{ 19, "Inconnu !" },
{ 20, "Inconnu !" },
{ 21, "Inconnu !" },
{ 22, "Inconnu !" },
{ 23, "Inconnu !" },
{ 24, "Inconnu !" },
{ 25, "Inconnu !" },
{ 26, "Inconnu !" },
{ 27, "Inconnu !" },
{ 28, "Inconnu !" },
{ 29, "Inconnu !" }
});
migrationBuilder.AddForeignKey(
name: "FK_CategorieRunes_PageRunes_IdPageRune",
table: "CategorieRunes",
column: "IdPageRune",
principalTable: "PageRunes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CategorieRunes_Runes_IdRune",
table: "CategorieRunes",
column: "IdRune",
principalTable: "Runes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_CategorieRunes_PageRunes_IdPageRune",
table: "CategorieRunes");
migrationBuilder.DropForeignKey(
name: "FK_CategorieRunes_Runes_IdRune",
table: "CategorieRunes");
migrationBuilder.DropPrimaryKey(
name: "PK_PageRunes",
table: "PageRunes");
migrationBuilder.DropPrimaryKey(
name: "PK_CategorieRunes",
table: "CategorieRunes");
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 3);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 4);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 5);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 6);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 7);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 8);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 9);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 10);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 11);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 12);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 13);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 14);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 15);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 16);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 17);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 18);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 19);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 20);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 21);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 22);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 23);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 24);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 25);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 26);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 27);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 28);
migrationBuilder.DeleteData(
table: "Images",
keyColumn: "Id",
keyValue: 29);
migrationBuilder.RenameTable(
name: "PageRunes",
newName: "EntityPageRune");
migrationBuilder.RenameTable(
name: "CategorieRunes",
newName: "EntityCategorieRune");
migrationBuilder.RenameIndex(
name: "IX_CategorieRunes_IdRune",
table: "EntityCategorieRune",
newName: "IX_EntityCategorieRune_IdRune");
migrationBuilder.RenameIndex(
name: "IX_CategorieRunes_IdPageRune",
table: "EntityCategorieRune",
newName: "IX_EntityCategorieRune_IdPageRune");
migrationBuilder.AddPrimaryKey(
name: "PK_EntityPageRune",
table: "EntityPageRune",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_EntityCategorieRune",
table: "EntityCategorieRune",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_EntityCategorieRune_EntityPageRune_IdPageRune",
table: "EntityCategorieRune",
column: "IdPageRune",
principalTable: "EntityPageRune",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_EntityCategorieRune_Runes_IdRune",
table: "EntityCategorieRune",
column: "IdRune",
principalTable: "Runes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

@ -26,6 +26,10 @@ namespace EntityFramwork.Migrations
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Classe")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
@ -48,6 +52,31 @@ namespace EntityFramwork.Migrations
b.ToTable("Champions");
});
modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Category")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("IdPageRune")
.HasColumnType("INTEGER");
b.Property<int>("IdRune")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("IdPageRune");
b.HasIndex("IdRune");
b.ToTable("CategorieRunes");
});
modelBuilder.Entity("EntityFramwork.EntityLargeImage", b =>
{
b.Property<int>("Id")
@ -61,6 +90,168 @@ namespace EntityFramwork.Migrations
b.HasKey("Id");
b.ToTable("Images");
b.HasData(
new
{
Id = 1,
Base64 = "Inconnu !"
},
new
{
Id = 2,
Base64 = "Inconnu !"
},
new
{
Id = 3,
Base64 = "Inconnu !"
},
new
{
Id = 4,
Base64 = "Inconnu !"
},
new
{
Id = 5,
Base64 = "Inconnu !"
},
new
{
Id = 6,
Base64 = "Inconnu !"
},
new
{
Id = 7,
Base64 = "Inconnu !"
},
new
{
Id = 8,
Base64 = "Inconnu !"
},
new
{
Id = 9,
Base64 = "Inconnu !"
},
new
{
Id = 10,
Base64 = "Inconnu !"
},
new
{
Id = 11,
Base64 = "Inconnu !"
},
new
{
Id = 12,
Base64 = "Inconnu !"
},
new
{
Id = 13,
Base64 = "Inconnu !"
},
new
{
Id = 14,
Base64 = "Inconnu !"
},
new
{
Id = 15,
Base64 = "Inconnu !"
},
new
{
Id = 16,
Base64 = "Inconnu !"
},
new
{
Id = 17,
Base64 = "Inconnu !"
},
new
{
Id = 18,
Base64 = "Inconnu !"
},
new
{
Id = 19,
Base64 = "Inconnu !"
},
new
{
Id = 20,
Base64 = "Inconnu !"
},
new
{
Id = 21,
Base64 = "Inconnu !"
},
new
{
Id = 22,
Base64 = "Inconnu !"
},
new
{
Id = 23,
Base64 = "Inconnu !"
},
new
{
Id = 24,
Base64 = "Inconnu !"
},
new
{
Id = 25,
Base64 = "Inconnu !"
},
new
{
Id = 26,
Base64 = "Inconnu !"
},
new
{
Id = 27,
Base64 = "Inconnu !"
},
new
{
Id = 28,
Base64 = "Inconnu !"
},
new
{
Id = 29,
Base64 = "Inconnu !"
});
});
modelBuilder.Entity("EntityFramwork.EntityPageRune", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("PageRunes");
});
modelBuilder.Entity("EntityFramwork.EntityRunes", b =>
@ -73,6 +264,10 @@ namespace EntityFramwork.Migrations
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Family")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
@ -92,13 +287,41 @@ namespace EntityFramwork.Migrations
b.ToTable("Runes");
});
modelBuilder.Entity("EntityFramwork.EntitySkill", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("ChampionId")
.HasColumnType("INTEGER");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("ChampionId");
b.ToTable("Skills");
});
modelBuilder.Entity("EntityFramwork.EntitySkins", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("ChampionForeignKey")
b.Property<int>("ChampionId")
.HasColumnType("INTEGER");
b.Property<string>("Description")
@ -117,7 +340,7 @@ namespace EntityFramwork.Migrations
b.HasKey("Id");
b.HasIndex("ChampionForeignKey");
b.HasIndex("ChampionId");
b.HasIndex("ImageId")
.IsUnique();
@ -136,6 +359,25 @@ namespace EntityFramwork.Migrations
b.Navigation("Image");
});
modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{
b.HasOne("EntityFramwork.EntityPageRune", "PageRune")
.WithMany("CategorieRune")
.HasForeignKey("IdPageRune")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntityFramwork.EntityRunes", "Rune")
.WithMany("CategorieRune")
.HasForeignKey("IdRune")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("PageRune");
b.Navigation("Rune");
});
modelBuilder.Entity("EntityFramwork.EntityRunes", b =>
{
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
@ -147,11 +389,22 @@ namespace EntityFramwork.Migrations
b.Navigation("Image");
});
modelBuilder.Entity("EntityFramwork.EntitySkill", b =>
{
b.HasOne("DTO.EntityChampions", "Champions")
.WithMany("Skills")
.HasForeignKey("ChampionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Champions");
});
modelBuilder.Entity("EntityFramwork.EntitySkins", b =>
{
b.HasOne("DTO.EntityChampions", "Champion")
.WithMany("Skins")
.HasForeignKey("ChampionForeignKey")
.HasForeignKey("ChampionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
@ -168,6 +421,8 @@ namespace EntityFramwork.Migrations
modelBuilder.Entity("DTO.EntityChampions", b =>
{
b.Navigation("Skills");
b.Navigation("Skins");
});
@ -182,6 +437,16 @@ namespace EntityFramwork.Migrations
b.Navigation("Skin")
.IsRequired();
});
modelBuilder.Entity("EntityFramwork.EntityPageRune", b =>
{
b.Navigation("CategorieRune");
});
modelBuilder.Entity("EntityFramwork.EntityRunes", b =>
{
b.Navigation("CategorieRune");
});
#pragma warning restore 612, 618
}
}

Loading…
Cancel
Save