push Bdd (sauf dico et skill)

rune
Louison PARANT 2 years ago
parent 6650ce89e0
commit 12b0acc1a9

@ -5,9 +5,16 @@ namespace EntityFrameworkLOL.DBContexts
{
class SQLiteContext : DbContext
{
public DbSet<ChampionEntity> Champion { get; set; }
public DbSet<CategoryEntity> Category { get; set; }
public DbSet<RuneFamilyEntity> RuneFamily { get; set; }
public DbSet<ImageEntity> Image { get; set; }
public DbSet<SkillTypeEntity> SkillType { get; set; }
//public DbSet<SkillEntity> Skill { get; set; }
public DbSet<SkinEntity> Skin { get; set; }
public DbSet<RuneEntity> Rune { get; set; }
public DbSet<ChampionClassEntity> ChampionClass { get; set; }
public DbSet<RunePageEntity> RunePage { get; set; }
public DbSet<ChampionEntity> Champion { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite($"Data Source=DBLOL.db");

@ -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; }
}
}

@ -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; }
}
}

@ -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<string, int> Characteristics { get; set; }
public ChampionClassEntity Class { get; set; }
public ImageEntity Image { get; set; }
//public ICollection<Skill> Skills { get; set; }
}
}

@ -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; }
}
}

@ -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; }
}
}

@ -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; }
}
}

@ -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<CategoryEntity, RuneEntity> Dictionary { get; set; }
// Switch Dictionary to List puis faudra juste mapper la liste en dico
}
}

@ -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<ChampionEntity> Champions { get; set; }
}
}

@ -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; }
}
}

@ -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; }
}
}

@ -25,4 +25,8 @@
<Folder Include="Migrations\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj" />
</ItemGroup>
</Project>

@ -1,81 +0,0 @@
// <auto-generated />
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
{
/// <inheritdoc />
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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Bio")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Champion");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.RuneEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Rune");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.SkinEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Skin");
});
#pragma warning restore 612, 618
}
}
}

@ -1,69 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntityFrameworkLOL.Migrations
{
/// <inheritdoc />
public partial class MigrationWallah3 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Champion",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false),
Bio = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Champion", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Rune",
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)
},
constraints: table =>
{
table.PrimaryKey("PK_Rune", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Skin",
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)
},
constraints: table =>
{
table.PrimaryKey("PK_Skin", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Champion");
migrationBuilder.DropTable(
name: "Rune");
migrationBuilder.DropTable(
name: "Skin");
}
}
}

@ -0,0 +1,227 @@
// <auto-generated />
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
{
/// <inheritdoc />
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<int>("Category")
.HasColumnType("INTEGER");
b.HasKey("Category");
b.ToTable("Category");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.ChampionClassEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Class")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("ChampionClass");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.ChampionEntity", b =>
{
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Bio")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("ClassId")
.HasColumnType("INTEGER");
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("ImageBase64")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Name");
b.HasIndex("ClassId");
b.HasIndex("ImageBase64");
b.ToTable("Champion");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.ImageEntity", b =>
{
b.Property<string>("Base64")
.HasColumnType("TEXT");
b.HasKey("Base64");
b.ToTable("Image");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.RuneEntity", b =>
{
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("FamilyId")
.HasColumnType("INTEGER");
b.Property<string>("ImageBase64")
.HasColumnType("TEXT");
b.HasKey("Name");
b.HasIndex("FamilyId");
b.HasIndex("ImageBase64");
b.ToTable("Rune");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.RuneFamilyEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Family")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("RuneFamily");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.RunePageEntity", b =>
{
b.Property<string>("Name")
.HasColumnType("TEXT");
b.HasKey("Name");
b.ToTable("RunePage");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.SkillTypeEntity", b =>
{
b.Property<int>("Type")
.HasColumnType("INTEGER");
b.HasKey("Type");
b.ToTable("SkillType");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.SkinEntity", b =>
{
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("ChampionSkinName")
.HasColumnType("TEXT");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("ImageBase64")
.HasColumnType("TEXT");
b.Property<float>("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
}
}
}

@ -0,0 +1,223 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntityFrameworkLOL.Migrations
{
/// <inheritdoc />
public partial class MigrationWallah4 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Category",
columns: table => new
{
Category = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Category", x => x.Category);
});
migrationBuilder.CreateTable(
name: "ChampionClass",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Class = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ChampionClass", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Image",
columns: table => new
{
Base64 = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Image", x => x.Base64);
});
migrationBuilder.CreateTable(
name: "RuneFamily",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Family = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RuneFamily", x => x.Id);
});
migrationBuilder.CreateTable(
name: "RunePage",
columns: table => new
{
Name = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RunePage", x => x.Name);
});
migrationBuilder.CreateTable(
name: "SkillType",
columns: table => new
{
Type = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SkillType", x => x.Type);
});
migrationBuilder.CreateTable(
name: "Champion",
columns: table => new
{
Name = table.Column<string>(type: "TEXT", nullable: false),
Bio = table.Column<string>(type: "TEXT", nullable: false),
Icon = table.Column<string>(type: "TEXT", nullable: false),
ClassId = table.Column<int>(type: "INTEGER", nullable: false),
ImageBase64 = table.Column<string>(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<string>(type: "TEXT", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: false),
ImageBase64 = table.Column<string>(type: "TEXT", nullable: true),
FamilyId = table.Column<int>(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<string>(type: "TEXT", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: false),
Icon = table.Column<string>(type: "TEXT", nullable: false),
Price = table.Column<float>(type: "REAL", nullable: false),
ImageBase64 = table.Column<string>(type: "TEXT", nullable: true),
ChampionSkinName = table.Column<string>(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");
}
/// <inheritdoc />
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");
}
}
}

@ -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<int>("Category")
.HasColumnType("INTEGER");
b.HasKey("Category");
b.ToTable("Category");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.ChampionClassEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Class")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("ChampionClass");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.ChampionEntity", b =>
{
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Bio")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
b.Property<int>("ClassId")
.HasColumnType("INTEGER");
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.Property<string>("ImageBase64")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Name");
b.HasIndex("ClassId");
b.HasIndex("ImageBase64");
b.ToTable("Champion");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.ImageEntity", b =>
{
b.Property<string>("Base64")
.HasColumnType("TEXT");
b.HasKey("Base64");
b.ToTable("Image");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.RuneEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
b.Property<int>("FamilyId")
.HasColumnType("INTEGER");
b.Property<string>("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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Family")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("RuneFamily");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.RunePageEntity", b =>
{
b.Property<string>("Name")
.HasColumnType("TEXT");
b.HasKey("Name");
b.ToTable("RunePage");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.SkillTypeEntity", b =>
{
b.Property<int>("Type")
.HasColumnType("INTEGER");
b.HasKey("Type");
b.ToTable("SkillType");
});
modelBuilder.Entity("EntityFrameworkLOL.Entities.SkinEntity", b =>
{
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("ChampionSkinName")
.HasColumnType("TEXT");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.Property<string>("ImageBase64")
.HasColumnType("TEXT");
b.Property<float>("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
}
}

@ -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())
{

Loading…
Cancel
Save