diff --git a/EntityFramework_LoL/Sources/ConsoleDb/ConsoleDb.csproj b/EntityFramework_LoL/Sources/ConsoleDb/ConsoleDb.csproj new file mode 100644 index 0000000..8c3f25a --- /dev/null +++ b/EntityFramework_LoL/Sources/ConsoleDb/ConsoleDb.csproj @@ -0,0 +1,13 @@ + + + + Exe + net6.0 + enable + enable + + + + + + diff --git a/EntityFramework_LoL/Sources/ConsoleDb/Program.cs b/EntityFramework_LoL/Sources/ConsoleDb/Program.cs new file mode 100644 index 0000000..08b7c8d --- /dev/null +++ b/EntityFramework_LoL/Sources/ConsoleDb/Program.cs @@ -0,0 +1,4 @@ +using EFLib; + +ChampionEntity ChampionEntity + diff --git a/EntityFramework_LoL/Sources/EFLib/ChampionEntity.cs b/EntityFramework_LoL/Sources/EFLib/ChampionEntity.cs new file mode 100644 index 0000000..d2ec9a0 --- /dev/null +++ b/EntityFramework_LoL/Sources/EFLib/ChampionEntity.cs @@ -0,0 +1,17 @@ +using System; +namespace EFLib +{ + public class ChampionEntity + { + + public int Id { get; set; } + + public string Name { get; set; } + + public string Icon { get; set; } + + public string Bio { get; set; } + + } +} + diff --git a/EntityFramework_LoL/Sources/EFLib/EFLib.csproj b/EntityFramework_LoL/Sources/EFLib/EFLib.csproj new file mode 100644 index 0000000..fcb4a9f --- /dev/null +++ b/EntityFramework_LoL/Sources/EFLib/EFLib.csproj @@ -0,0 +1,29 @@ + + + + Exe + net6.0 + enable + enable + $(MSBuildProjectDirectory) + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + diff --git a/EntityFramework_LoL/Sources/EFLib/LolContext.cs b/EntityFramework_LoL/Sources/EFLib/LolContext.cs new file mode 100644 index 0000000..664a267 --- /dev/null +++ b/EntityFramework_LoL/Sources/EFLib/LolContext.cs @@ -0,0 +1,13 @@ +using System; +using Microsoft.EntityFrameworkCore; + +namespace EFLib +{ + public class LolContext : DbContext + { + public DbSet Champions { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) => optionsBuilder.UseSqlite("Data Source=oiseaux.db"); + } +} + diff --git a/EntityFramework_LoL/Sources/EFLib/Migrations/20230126083419_oiseaux.Designer.cs b/EntityFramework_LoL/Sources/EFLib/Migrations/20230126083419_oiseaux.Designer.cs new file mode 100644 index 0000000..15b2f75 --- /dev/null +++ b/EntityFramework_LoL/Sources/EFLib/Migrations/20230126083419_oiseaux.Designer.cs @@ -0,0 +1,47 @@ +// +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(LolContext))] + [Migration("20230126083419_oiseaux")] + partial class oiseaux + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.2"); + + modelBuilder.Entity("EFLib.ChampionEntity", 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/EntityFramework_LoL/Sources/EFLib/Migrations/20230126083419_oiseaux.cs b/EntityFramework_LoL/Sources/EFLib/Migrations/20230126083419_oiseaux.cs new file mode 100644 index 0000000..7336329 --- /dev/null +++ b/EntityFramework_LoL/Sources/EFLib/Migrations/20230126083419_oiseaux.cs @@ -0,0 +1,36 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFLib.Migrations +{ + /// + public partial class oiseaux : 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), + Icon = table.Column(type: "TEXT", nullable: false), + Bio = 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/EntityFramework_LoL/Sources/EFLib/Migrations/LolContextModelSnapshot.cs b/EntityFramework_LoL/Sources/EFLib/Migrations/LolContextModelSnapshot.cs new file mode 100644 index 0000000..e3c0e56 --- /dev/null +++ b/EntityFramework_LoL/Sources/EFLib/Migrations/LolContextModelSnapshot.cs @@ -0,0 +1,44 @@ +// +using EFLib; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFLib.Migrations +{ + [DbContext(typeof(LolContext))] + partial class LolContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.2"); + + modelBuilder.Entity("EFLib.ChampionEntity", 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/EntityFramework_LoL/Sources/EFLib/Program.cs b/EntityFramework_LoL/Sources/EFLib/Program.cs new file mode 100644 index 0000000..3ed0e5d --- /dev/null +++ b/EntityFramework_LoL/Sources/EFLib/Program.cs @@ -0,0 +1,3 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); + diff --git a/EntityFramework_LoL/Sources/EFLib/oiseaux.db b/EntityFramework_LoL/Sources/EFLib/oiseaux.db new file mode 100644 index 0000000..adc9f7b Binary files /dev/null and b/EntityFramework_LoL/Sources/EFLib/oiseaux.db differ diff --git a/EntityFramework_LoL/Sources/LeagueOfLegends.sln b/EntityFramework_LoL/Sources/LeagueOfLegends.sln index 0ea57ff..ee0f61a 100644 --- a/EntityFramework_LoL/Sources/LeagueOfLegends.sln +++ b/EntityFramework_LoL/Sources/LeagueOfLegends.sln @@ -15,6 +15,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Stub", "Stub", "{2C607793-B EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StubLib", "StubLib\StubLib.csproj", "{B01D7EF2-2D64-409A-A29A-61FB7BB7A9DB}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EFLib", "EFLib\EFLib.csproj", "{D331DDC5-0CC9-4C6A-802A-31C528617602}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleDb", "ConsoleDb\ConsoleDb.csproj", "{30AF9CBD-1E40-46F2-973F-6C13F1E15660}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -37,6 +41,14 @@ Global {B01D7EF2-2D64-409A-A29A-61FB7BB7A9DB}.Debug|Any CPU.Build.0 = Debug|Any CPU {B01D7EF2-2D64-409A-A29A-61FB7BB7A9DB}.Release|Any CPU.ActiveCfg = Release|Any CPU {B01D7EF2-2D64-409A-A29A-61FB7BB7A9DB}.Release|Any CPU.Build.0 = Release|Any CPU + {D331DDC5-0CC9-4C6A-802A-31C528617602}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D331DDC5-0CC9-4C6A-802A-31C528617602}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D331DDC5-0CC9-4C6A-802A-31C528617602}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D331DDC5-0CC9-4C6A-802A-31C528617602}.Release|Any CPU.Build.0 = Release|Any CPU + {30AF9CBD-1E40-46F2-973F-6C13F1E15660}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {30AF9CBD-1E40-46F2-973F-6C13F1E15660}.Debug|Any CPU.Build.0 = Debug|Any CPU + {30AF9CBD-1E40-46F2-973F-6C13F1E15660}.Release|Any CPU.ActiveCfg = Release|Any CPU + {30AF9CBD-1E40-46F2-973F-6C13F1E15660}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/EntityFramework_LoL/Sources/Model/Model.csproj b/EntityFramework_LoL/Sources/Model/Model.csproj index 27b2839..f898697 100644 --- a/EntityFramework_LoL/Sources/Model/Model.csproj +++ b/EntityFramework_LoL/Sources/Model/Model.csproj @@ -1,13 +1,19 @@ + net6.0 enable enable + $(MSBuildProjectDirectory) + + + + @@ -15,4 +21,17 @@ + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + diff --git a/EntityFramework_LoL/Sources/Shared/Shared.csproj b/EntityFramework_LoL/Sources/Shared/Shared.csproj index bafd05b..addd042 100644 --- a/EntityFramework_LoL/Sources/Shared/Shared.csproj +++ b/EntityFramework_LoL/Sources/Shared/Shared.csproj @@ -6,4 +6,22 @@ enable + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + diff --git a/EntityFramework_LoL/Sources/StubLib/StubLib.csproj b/EntityFramework_LoL/Sources/StubLib/StubLib.csproj index f05027c..6d93d37 100644 --- a/EntityFramework_LoL/Sources/StubLib/StubLib.csproj +++ b/EntityFramework_LoL/Sources/StubLib/StubLib.csproj @@ -9,4 +9,22 @@ + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + diff --git a/EntityFramework_LoL/Sources/Tests/ConsoleTests/ConsoleTests.csproj b/EntityFramework_LoL/Sources/Tests/ConsoleTests/ConsoleTests.csproj index 1602b94..039482e 100644 --- a/EntityFramework_LoL/Sources/Tests/ConsoleTests/ConsoleTests.csproj +++ b/EntityFramework_LoL/Sources/Tests/ConsoleTests/ConsoleTests.csproj @@ -13,8 +13,22 @@ + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + +