diff --git a/Sources/EFlib/EFChampion.cs b/Sources/EFlib/EFChampion.cs index 6cc6f8a..3e9955a 100644 --- a/Sources/EFlib/EFChampion.cs +++ b/Sources/EFlib/EFChampion.cs @@ -2,24 +2,22 @@ using Model; using System.Collections.Immutable; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; namespace EFlib { public class EFChampion { - // public int Id { get; set; } - // https://learn.microsoft.com/fr-fr/ef/core/modeling/keyless-entity-types?tabs=data-annotations - /**** Only Attributs ****/ - //[Key] + [Key] public string Name { get; set; } - //[MaxLength(500)] + [MaxLength(500)] public string Bio { get; set; } public string Icon { get; set; } public ReadOnlyDictionary Characteristics { get; private set; } public EFChampionClass Class { get; set; } public ReadOnlyCollection Skins { get; private set; } - public ImmutableHashSet Skills { get; private set; } + public ImmutableHashSet Skills { get; private set; } public LargeImage Image { get; set; } } } \ No newline at end of file diff --git a/Sources/EFlib/EFChampionClass.cs b/Sources/EFlib/EFChampionClass.cs index ebdd17a..a140f9b 100644 --- a/Sources/EFlib/EFChampionClass.cs +++ b/Sources/EFlib/EFChampionClass.cs @@ -12,7 +12,7 @@ namespace EFlib public class EFChampionClass { [Key] - [ForeignKey("ChampionEntity")] + [ForeignKey("EFChampion")] public int Id { get; set; } public ChampionClass Class { get; set; } } diff --git a/Sources/EFlib/Migrations/20230209074746_MyMigration.Designer.cs b/Sources/EFlib/Migrations/20230209074746_MyMigration.Designer.cs deleted file mode 100644 index fe24406..0000000 --- a/Sources/EFlib/Migrations/20230209074746_MyMigration.Designer.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -using EFlib; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace EFlib.Migrations -{ - [DbContext(typeof(SQLiteContext))] - [Migration("20230209074746_MyMigration")] - partial class MyMigration - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "7.0.2"); - - modelBuilder.Entity("EFlib.EFChampion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bio") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Icon") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Champions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Sources/EFlib/Migrations/20230209074746_MyMigration.cs b/Sources/EFlib/Migrations/20230209074746_MyMigration.cs deleted file mode 100644 index 89fd4fc..0000000 --- a/Sources/EFlib/Migrations/20230209074746_MyMigration.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace EFlib.Migrations -{ - /// - public partial class MyMigration : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Champions", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: false), - Bio = table.Column(type: "TEXT", nullable: false), - Icon = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Champions", x => x.Id); - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Champions"); - } - } -} diff --git a/Sources/EFlib/Migrations/SQLiteContextModelSnapshot.cs b/Sources/EFlib/Migrations/SQLiteContextModelSnapshot.cs deleted file mode 100644 index e01ab0f..0000000 --- a/Sources/EFlib/Migrations/SQLiteContextModelSnapshot.cs +++ /dev/null @@ -1,44 +0,0 @@ -// -using EFlib; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace EFlib.Migrations -{ - [DbContext(typeof(SQLiteContext))] - partial class SQLiteContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "7.0.2"); - - modelBuilder.Entity("EFlib.EFChampion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bio") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Icon") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Champions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Sources/EFlib/projet.dbloulou.db b/Sources/EFlib/projet.dbloulou.db deleted file mode 100644 index 81497ee..0000000 Binary files a/Sources/EFlib/projet.dbloulou.db and /dev/null differ