Ver código fonte

change the way DBcontext is initialized

Florian Morel 1 ano atrás
pai
commit
6113c54d3b

+ 0 - 4
Dotnet/DataLayer/DataLayer.csproj

@@ -21,10 +21,6 @@
     <ProjectReference Include="..\Domain\Domain.csproj" />
   </ItemGroup>
 
-  <ItemGroup>
-    <Folder Include="Migrations\" />
-  </ItemGroup>
-
   <ItemGroup>
     <None Update="XMLTEST\01 - ldb.xml">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

+ 235 - 95
Dotnet/DataLayer/DbContextInitializer.cs

@@ -73,187 +73,327 @@ public static class DbContextInitializer
     private static void GetRootsElements(List<Root> roots, string filesPath)
     {
         var fileExist = Directory.Exists(filesPath);
-        if (fileExist)
-        {
-            var xmlFiles = Directory.GetFiles(filesPath, "*.xml");
+        if (!fileExist) return;
+        var xmlFiles = Directory.GetFiles(filesPath, "*.xml");
 
-            foreach (var xmlFile in xmlFiles)
-            {
-                var root = XmlHelper.DeserializeXmlFile<Root>(xmlFile);
-                roots.Add(root);
-            }
-        }
+        roots.AddRange(xmlFiles.Select(XmlHelper.DeserializeXmlFile<Root>));
     }
 
     private static void ExtractFromRoot(DeathwatchDbContext context, List<Root> roots)
     {
-        foreach (var root in roots)
+        foreach (var root in roots.OfType<Root>())
         {
-            if (root != null)
+            if (!context.Accessoires.Any())
+                context.Accessoires.AddRange(root.AccessoiresArmes);
+            else
             {
-                if (root.Extensions != null && root.Extensions != null && !context.Extensions.Any())
+                foreach (var item in root.AccessoiresArmes.Where(item => !context.Accessoires.Any(e => e.Id == item.Id)))
                 {
-                    context.Extensions.AddRange(root.Extensions);
-                    context.SaveChanges();
+                    context.Accessoires.Add(item);
                 }
+            }
 
-                if (root.AccessoiresArmes != null && root.AccessoiresArmes != null && !context.Accessoires.Any())
-                {
-                    context.Accessoires.AddRange(root.AccessoiresArmes);
-                    context.SaveChanges();
-                }
+            context.SaveChanges();
 
-                if (root.Améliorations != null && root.Améliorations != null && !context.Améliorations.Any())
+            if (!context.Améliorations.Any())
+                context.Améliorations.AddRange(root.Améliorations);
+            else
+            {
+                foreach (var item in root.Améliorations.Where(item => !context.Améliorations.Any(e => e.Id == item.Id)))
                 {
-                    context.Améliorations.AddRange(root.Améliorations);
-                    context.SaveChanges();
+                    context.Améliorations.Add(item);
                 }
+            }
 
-                if (root.Archétypes != null && root.Archétypes != null && !context.Archétypes.Any())
+            context.SaveChanges();
+
+            if (!context.Archétypes.Any())
+                context.Archétypes.AddRange(root.Archétypes);
+            else
+            {
+                foreach (var item in root.Archétypes.Where(item => !context.Archétypes.Any(e => e.Id == item.Id)))
                 {
-                    context.Archétypes.AddRange(root.Archétypes);
-                    context.SaveChanges();
+                    context.Archétypes.Add(item);
                 }
+            }
+
+            context.SaveChanges();
 
-                if (root.Armes != null && root.Armes != null && !context.Armes.Any())
+            if (!context.Armes.Any())
+                context.Armes.AddRange(root.Armes);
+            else
+            {
+                foreach (var item in root.Armes.Where(item => !context.Armes.Any(e => e.Id == item.Id)))
                 {
-                    context.Armes.AddRange(root.Armes);
-                    context.SaveChanges();
+                    context.Armes.Add(item);
                 }
+            }
+
+            context.SaveChanges();
 
-                if (root.Armures != null && root.Armures != null && !context.Armures.Any())
+            if (!context.Armures.Any())
+                context.Armures.AddRange(root.Armures);
+            else
+            {
+                foreach (var item in root.Armures.Where(item => !context.Armures.Any(e => e.Id == item.Id)))
                 {
-                    context.Armures.AddRange(root.Armures);
-                    context.SaveChanges();
+                    context.Armures.Add(item);
                 }
+            }
+
+            context.SaveChanges();
 
-                if (root.Assermentations != null && root.Assermentations != null && !context.Assermentations.Any())
+            if (!context.Assermentations.Any())
+                context.Assermentations.AddRange(root.Assermentations);
+            else
+            {
+                foreach (var item in root.Assermentations.Where(item => !context.Assermentations.Any(e => e.Id == item.Id)))
                 {
-                    context.Assermentations.AddRange(root.Assermentations);
-                    context.SaveChanges();
+                    context.Assermentations.Add(item);
                 }
+            }
 
-                if (root.AttributsArmes != null && root.AttributsArmes != null && !context.Attributs.Any())
+            context.SaveChanges();
+
+            if (!context.Attributs.Any())
+                context.Attributs.AddRange(root.AttributsArmes);
+            else
+            {
+                foreach (var item in root.AttributsArmes.Where(item => !context.Attributs.Any(e => e.Id == item.Id)))
                 {
-                    context.Attributs.AddRange(root.AttributsArmes);
-                    context.SaveChanges();
+                    context.Attributs.Add(item);
                 }
+            }
 
-                if (root.Carrières != null && root.Carrières != null && !context.Carrières.Any())
+            context.SaveChanges();
+
+            if (!context.Carrières.Any())
+                context.Carrières.AddRange(root.Carrières);
+            else
+            {
+                foreach (var item in root.Carrières.Where(item => !context.Carrières.Any(e => e.Id == item.Id)))
                 {
-                    context.Carrières.AddRange(root.Carrières);
-                    context.SaveChanges();
+                    context.Carrières.Add(item);
                 }
+            }
+
+            context.SaveChanges();
 
-                if (root.Competences != null && root.Competences != null && !context.Competences.Any())
+            if (!context.Competences.Any())
+                context.Competences.AddRange(root.Competences);
+            else
+            {
+                foreach (var item in root.Competences.Where(item => !context.Competences.Any(e => e.Id == item.Id)))
                 {
-                    context.Competences.AddRange(root.Competences);
-                    context.SaveChanges();
+                    context.Competences.Add(item);
                 }
+            }
+
+            context.SaveChanges();
 
-                if (root.Coordonnées != null && root.Coordonnées != null && !context.Coordonnées.Any())
+            if (!context.Coordonnées.Any())
+                context.Coordonnées.AddRange(root.Coordonnées);
+            else
+            {
+                foreach (var item in root.Coordonnées.Where(item => !context.Coordonnées.Any(e => e.Id == item.Id)))
                 {
-                    context.Coordonnées.AddRange(root.Coordonnées);
-                    context.SaveChanges();
+                    context.Coordonnées.Add(item);
                 }
+            }
 
-                if (root.Cybernétiques != null && root.Cybernétiques != null && !context.Cybernétiques.Any())
-                {
-                    context.Cybernétiques.AddRange(root.Cybernétiques);
+            context.SaveChanges();
 
-                    context.SaveChanges();
+            if (!context.Cybernétiques.Any())
+                context.Cybernétiques.AddRange(root.Cybernétiques);
+            else
+            {
+                foreach (var item in root.Cybernétiques.Where(item => !context.Cybernétiques.Any(e => e.Id == item.Id)))
+                {
+                    context.Cybernétiques.Add(item);
                 }
+            }
+
+            context.SaveChanges();
 
-                if (root.Disciplines != null && root.Disciplines != null && !context.Disciplines.Any())
+            if (!context.Disciplines.Any())
+                context.Disciplines.AddRange(root.Disciplines);
+            else
+            {
+                foreach (var item in root.Disciplines.Where(item => !context.Disciplines.Any(e => e.Id == item.Id)))
                 {
-                    context.Disciplines.AddRange(root.Disciplines);
-                    context.SaveChanges();
+                    context.Disciplines.Add(item);
                 }
+            }
+
+            context.SaveChanges();
 
-                if (root.Divinations != null && root.Divinations != null && !context.Divinations.Any())
+            if (!context.Divinations.Any())
+                context.Divinations.AddRange(root.Divinations);
+            else
+            {
+                foreach (var item in root.Divinations.Where(item => !context.Divinations.Any(e => e.Id == item.Id)))
                 {
-                    context.Divinations.AddRange(root.Divinations);
-                    context.SaveChanges();
+                    context.Divinations.Add(item);
                 }
+            }
+
+            context.SaveChanges();
 
-                if (root.Equipements != null && root.Equipements != null && !context.Equipements.Any())
+            if (!context.Equipements.Any())
+                context.Equipements.AddRange(root.Equipements);
+            else
+            {
+                foreach (var item in root.Equipements.Where(item => !context.Equipements.Any(e => e.Id == item.Id)))
                 {
-                    context.Equipements.AddRange(root.Equipements);
-                    context.SaveChanges();
+                    context.Equipements.Add(item);
                 }
+            }
+
+            context.SaveChanges();
 
-                if (root.Implants != null && root.Implants != null && !context.Implants.Any())
+            if (!context.Implants.Any())
+                context.Implants.AddRange(root.Implants);
+            else
+            {
+                foreach (var item in root.Implants.Where(item => !context.Implants.Any(e => e.Id == item.Id)))
                 {
-                    context.Implants.AddRange(root.Implants);
-                    context.SaveChanges();
+                    context.Implants.Add(item);
                 }
+            }
+
+            context.SaveChanges();
 
-                if (root.Mondes != null && root.Mondes != null && !context.Mondes.Any())
+            if (!context.Mondes.Any())
+                context.Mondes.AddRange(root.Mondes);
+            else
+            {
+                foreach (var item in root.Mondes.Where(item => !context.Mondes.Any(e => e.Id == item.Id)))
                 {
-                    context.Mondes.AddRange(root.Mondes);
-                    context.SaveChanges();
+                    context.Mondes.Add(item);
                 }
+            }
 
-                if (root.Mutations != null && root.Mutations != null && !context.Mutations.Any())
+            context.SaveChanges();
+
+            if (!context.Mutations.Any())
+                context.Mutations.AddRange(root.Mutations);
+            else
+            {
+                foreach (var item in root.Mutations.Where(item => !context.Mutations.Any(e => e.Id == item.Id)))
                 {
-                    context.Mutations.AddRange(root.Mutations);
-                    context.SaveChanges();
+                    context.Mutations.Add(item);
                 }
+            }
 
-                if (root.Pouvoirs != null && root.Pouvoirs != null && !context.Pouvoirs.Any())
+            context.SaveChanges();
+
+            if (!context.Pouvoirs.Any())
+                context.Pouvoirs.AddRange(root.Pouvoirs);
+            else
+            {
+                foreach (var item in root.Pouvoirs.Where(item => !context.Pouvoirs.Any(e => e.Id == item.Id)))
                 {
-                    context.Pouvoirs.AddRange(root.Pouvoirs);
-                    context.SaveChanges();
+                    context.Pouvoirs.Add(item);
                 }
+            }
+
+            context.SaveChanges();
 
-                if (root.Promotions != null && root.Promotions != null && !context.Promotions.Any())
+            if (!context.Promotions.Any())
+                context.Promotions.AddRange(root.Promotions);
+            else
+            {
+                foreach (var item in root.Promotions.Where(item => !context.Promotions.Any(e => e.Id == item.Id)))
                 {
-                    context.Promotions.AddRange(root.Promotions);
-                    context.SaveChanges();
+                    context.Promotions.Add(item);
                 }
+            }
+
+            context.SaveChanges();
 
-                if (root.SeuilsXp != null && root.SeuilsXp != null && !context.Seuils.Any())
+            if (!context.Seuils.Any())
+                context.Seuils.AddRange(root.SeuilsXp);
+            else
+            {
+                foreach (var item in root.SeuilsXp.Where(item => !context.Seuils.Any(e => e.Id == item.Id)))
                 {
-                    context.Seuils.AddRange(root.SeuilsXp);
-                    context.SaveChanges();
+                    context.Seuils.Add(item);
                 }
+            }
+
+            context.SaveChanges();
 
-                if (root.Sousmondes != null && root.Sousmondes != null && !context.Sousmondes.Any())
+            if (!context.Sousmondes.Any())
+                context.Sousmondes.AddRange(root.Sousmondes);
+            else
+            {
+                foreach (var item in root.Sousmondes.Where(item => !context.Sousmondes.Any(e => e.Id == item.Id)))
                 {
-                    context.Sousmondes.AddRange(root.Sousmondes);
-                    context.SaveChanges();
+                    context.Sousmondes.Add(item);
                 }
+            }
 
-                if (root.Talents != null && root.Talents != null && !context.Talents.Any())
+            context.SaveChanges();
+
+            if (!context.Talents.Any())
+                context.Talents.AddRange(root.Talents);
+            else
+            {
+                foreach (var item in root.Talents.Where(item => !context.Talents.Any(e => e.Id == item.Id)))
                 {
-                    context.Talents.AddRange(root.Talents);
-                    context.SaveChanges();
+                    context.Talents.Add(item);
                 }
+            }
 
-                if (root.Traits != null && root.Traits != null && !context.Traits.Any())
+            context.SaveChanges();
+
+            if (!context.Traits.Any())
+                context.Traits.AddRange(root.Traits);
+            else
+            {
+                foreach (var item in root.Traits.Where(item => !context.Traits.Any(e => e.Id == item.Id)))
                 {
-                    context.Traits.AddRange(root.Traits);
-                    context.SaveChanges();
+                    context.Traits.Add(item);
                 }
+            }
+
+            context.SaveChanges();
 
-                if (root.Troubles != null && root.Troubles != null && !context.Troubles.Any())
+            if (!context.Troubles.Any())
+                context.Troubles.AddRange(root.Troubles);
+            else
+            {
+                foreach (var item in root.Troubles.Where(item => !context.Troubles.Any(e => e.Id == item.Id)))
                 {
-                    context.Troubles.AddRange(root.Troubles);
-                    context.SaveChanges();
+                    context.Troubles.Add(item);
                 }
+            }
+
+            context.SaveChanges();
 
-                if (root.TypeMondes != null && root.TypeMondes != null && !context.TypeMondes.Any())
+            if (!context.TypeMondes.Any())
+                context.TypeMondes.AddRange(root.TypeMondes);
+            else
+            {
+                foreach (var item in root.TypeMondes.Where(item => !context.TypeMondes.Any(e => e.Id == item.Id)))
                 {
-                    context.TypeMondes.AddRange(root.TypeMondes);
-                    context.SaveChanges();
+                    context.TypeMondes.Add(item);
                 }
+            }
+
+            context.SaveChanges();
 
-                if (root.TypesNom != null && root.TypesNom != null && !context.TypesNom.Any())
+            if (!context.TypesNom.Any())
+                context.TypesNom.AddRange(root.TypesNom);
+            else
+            {
+                foreach (var item in root.TypesNom.Where(item => !context.TypesNom.Any(e => e.Id == item.Id)))
                 {
-                    context.TypesNom.AddRange(root.TypesNom);
-                    context.SaveChanges();
+                    context.TypesNom.Add(item);
                 }
             }
+
+            context.SaveChanges();
         }
     }
 }

+ 0 - 167
Dotnet/DataLayer/Migrations/20230106171505_InitialCreate.Designer.cs

@@ -1,167 +0,0 @@
-// <auto-generated />
-using System;
-using DataLayer;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-
-#nullable disable
-
-namespace DataLayer.Migrations
-{
-    [DbContext(typeof(DeathwatchDbContext))]
-    [Migration("20230106171505_InitialCreate")]
-    partial class InitialCreate
-    {
-        /// <inheritdoc />
-        protected override void BuildTargetModel(ModelBuilder modelBuilder)
-        {
-#pragma warning disable 612, 618
-            modelBuilder
-                .HasAnnotation("ProductVersion", "7.0.1")
-                .HasAnnotation("Relational:MaxIdentifierLength", 128);
-
-            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
-
-            modelBuilder.Entity("Domain.Player", b =>
-                {
-                    b.Property<int>("Id")
-                        .ValueGeneratedOnAdd()
-                        .HasColumnType("int");
-
-                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
-
-                    b.Property<int>("AG")
-                        .HasColumnType("int");
-
-                    b.Property<string>("Background")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<int>("CC")
-                        .HasColumnType("int");
-
-                    b.Property<int>("CT")
-                        .HasColumnType("int");
-
-                    b.Property<string>("CharacterName")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<DateTime>("CreatedDate")
-                        .HasColumnType("datetime2");
-
-                    b.Property<int>("E")
-                        .HasColumnType("int");
-
-                    b.Property<int>("Experience")
-                        .HasColumnType("int");
-
-                    b.Property<int>("F")
-                        .HasColumnType("int");
-
-                    b.Property<int>("FM")
-                        .HasColumnType("int");
-
-                    b.Property<int>("INT")
-                        .HasColumnType("int");
-
-                    b.Property<int>("MF")
-                        .HasColumnType("int");
-
-                    b.Property<DateTime>("ModifiedDate")
-                        .HasColumnType("datetime2");
-
-                    b.Property<string>("Name")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<int>("PER")
-                        .HasColumnType("int");
-
-                    b.Property<int>("SOC")
-                        .HasColumnType("int");
-
-                    b.HasKey("Id");
-
-                    b.ToTable("Players");
-                });
-
-            modelBuilder.Entity("Domain.Weapons.Weapon", b =>
-                {
-                    b.Property<int>("Id")
-                        .ValueGeneratedOnAdd()
-                        .HasColumnType("int");
-
-                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
-
-                    b.Property<string>("At")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<string>("Attribute")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<DateTime>("CreatedDate")
-                        .HasColumnType("datetime2");
-
-                    b.Property<string>("GPE")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<string>("Mode")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<DateTime>("ModifiedDate")
-                        .HasColumnType("datetime2");
-
-                    b.Property<string>("Name")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<int>("Pene")
-                        .HasColumnType("int");
-
-                    b.Property<int>("Range")
-                        .HasColumnType("int");
-
-                    b.Property<string>("Rch")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<string>("Type")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.HasKey("Id");
-
-                    b.ToTable("Weapons");
-                });
-
-            modelBuilder.Entity("PlayerWeapon", b =>
-                {
-                    b.Property<int>("PlayersId")
-                        .HasColumnType("int");
-
-                    b.Property<int>("WeaponsId")
-                        .HasColumnType("int");
-
-                    b.HasKey("PlayersId", "WeaponsId");
-
-                    b.HasIndex("WeaponsId");
-
-                    b.ToTable("PlayerWeapon");
-                });
-
-            modelBuilder.Entity("PlayerWeapon", b =>
-                {
-                    b.HasOne("Domain.Player", null)
-                        .WithMany()
-                        .HasForeignKey("PlayersId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-
-                    b.HasOne("Domain.Weapons.Weapon", null)
-                        .WithMany()
-                        .HasForeignKey("WeaponsId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-#pragma warning restore 612, 618
-        }
-    }
-}

+ 0 - 108
Dotnet/DataLayer/Migrations/20230106171505_InitialCreate.cs

@@ -1,108 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace DataLayer.Migrations
-{
-    /// <inheritdoc />
-    public partial class InitialCreate : Migration
-    {
-        /// <inheritdoc />
-        protected override void Up(MigrationBuilder migrationBuilder)
-        {
-            migrationBuilder.CreateTable(
-                name: "Players",
-                columns: table => new
-                {
-                    Id = table.Column<int>(type: "int", nullable: false)
-                        .Annotation("SqlServer:Identity", "1, 1"),
-                    Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
-                    CharacterName = table.Column<string>(type: "nvarchar(max)", nullable: true),
-                    Background = table.Column<string>(type: "nvarchar(max)", nullable: true),
-                    Experience = table.Column<int>(type: "int", nullable: false),
-                    CC = table.Column<int>(type: "int", nullable: false),
-                    CT = table.Column<int>(type: "int", nullable: false),
-                    F = table.Column<int>(type: "int", nullable: false),
-                    E = table.Column<int>(type: "int", nullable: false),
-                    AG = table.Column<int>(type: "int", nullable: false),
-                    INT = table.Column<int>(type: "int", nullable: false),
-                    PER = table.Column<int>(type: "int", nullable: false),
-                    FM = table.Column<int>(type: "int", nullable: false),
-                    SOC = table.Column<int>(type: "int", nullable: false),
-                    MF = table.Column<int>(type: "int", nullable: false),
-                    CreatedDate = table.Column<DateTime>(type: "datetime2", nullable: false),
-                    ModifiedDate = table.Column<DateTime>(type: "datetime2", nullable: false)
-                },
-                constraints: table =>
-                {
-                    table.PrimaryKey("PK_Players", x => x.Id);
-                });
-
-            migrationBuilder.CreateTable(
-                name: "Weapons",
-                columns: table => new
-                {
-                    Id = table.Column<int>(type: "int", nullable: false)
-                        .Annotation("SqlServer:Identity", "1, 1"),
-                    Range = table.Column<int>(type: "int", nullable: false),
-                    Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
-                    GPE = table.Column<string>(type: "nvarchar(max)", nullable: true),
-                    Type = table.Column<string>(type: "nvarchar(max)", nullable: true),
-                    Pene = table.Column<int>(type: "int", nullable: false),
-                    Mode = table.Column<string>(type: "nvarchar(max)", nullable: true),
-                    At = table.Column<string>(type: "nvarchar(max)", nullable: true),
-                    Rch = table.Column<string>(type: "nvarchar(max)", nullable: true),
-                    Attribute = table.Column<string>(type: "nvarchar(max)", nullable: true),
-                    CreatedDate = table.Column<DateTime>(type: "datetime2", nullable: false),
-                    ModifiedDate = table.Column<DateTime>(type: "datetime2", nullable: false)
-                },
-                constraints: table =>
-                {
-                    table.PrimaryKey("PK_Weapons", x => x.Id);
-                });
-
-            migrationBuilder.CreateTable(
-                name: "PlayerWeapon",
-                columns: table => new
-                {
-                    PlayersId = table.Column<int>(type: "int", nullable: false),
-                    WeaponsId = table.Column<int>(type: "int", nullable: false)
-                },
-                constraints: table =>
-                {
-                    table.PrimaryKey("PK_PlayerWeapon", x => new { x.PlayersId, x.WeaponsId });
-                    table.ForeignKey(
-                        name: "FK_PlayerWeapon_Players_PlayersId",
-                        column: x => x.PlayersId,
-                        principalTable: "Players",
-                        principalColumn: "Id",
-                        onDelete: ReferentialAction.Cascade);
-                    table.ForeignKey(
-                        name: "FK_PlayerWeapon_Weapons_WeaponsId",
-                        column: x => x.WeaponsId,
-                        principalTable: "Weapons",
-                        principalColumn: "Id",
-                        onDelete: ReferentialAction.Cascade);
-                });
-
-            migrationBuilder.CreateIndex(
-                name: "IX_PlayerWeapon_WeaponsId",
-                table: "PlayerWeapon",
-                column: "WeaponsId");
-        }
-
-        /// <inheritdoc />
-        protected override void Down(MigrationBuilder migrationBuilder)
-        {
-            migrationBuilder.DropTable(
-                name: "PlayerWeapon");
-
-            migrationBuilder.DropTable(
-                name: "Players");
-
-            migrationBuilder.DropTable(
-                name: "Weapons");
-        }
-    }
-}

+ 0 - 164
Dotnet/DataLayer/Migrations/DeathwatchDbContextModelSnapshot.cs

@@ -1,164 +0,0 @@
-// <auto-generated />
-using System;
-using DataLayer;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-
-#nullable disable
-
-namespace DataLayer.Migrations
-{
-    [DbContext(typeof(DeathwatchDbContext))]
-    partial class DeathwatchDbContextModelSnapshot : ModelSnapshot
-    {
-        protected override void BuildModel(ModelBuilder modelBuilder)
-        {
-#pragma warning disable 612, 618
-            modelBuilder
-                .HasAnnotation("ProductVersion", "7.0.1")
-                .HasAnnotation("Relational:MaxIdentifierLength", 128);
-
-            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
-
-            modelBuilder.Entity("Domain.Player", b =>
-                {
-                    b.Property<int>("Id")
-                        .ValueGeneratedOnAdd()
-                        .HasColumnType("int");
-
-                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
-
-                    b.Property<int>("AG")
-                        .HasColumnType("int");
-
-                    b.Property<string>("Background")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<int>("CC")
-                        .HasColumnType("int");
-
-                    b.Property<int>("CT")
-                        .HasColumnType("int");
-
-                    b.Property<string>("CharacterName")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<DateTime>("CreatedDate")
-                        .HasColumnType("datetime2");
-
-                    b.Property<int>("E")
-                        .HasColumnType("int");
-
-                    b.Property<int>("Experience")
-                        .HasColumnType("int");
-
-                    b.Property<int>("F")
-                        .HasColumnType("int");
-
-                    b.Property<int>("FM")
-                        .HasColumnType("int");
-
-                    b.Property<int>("INT")
-                        .HasColumnType("int");
-
-                    b.Property<int>("MF")
-                        .HasColumnType("int");
-
-                    b.Property<DateTime>("ModifiedDate")
-                        .HasColumnType("datetime2");
-
-                    b.Property<string>("Name")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<int>("PER")
-                        .HasColumnType("int");
-
-                    b.Property<int>("SOC")
-                        .HasColumnType("int");
-
-                    b.HasKey("Id");
-
-                    b.ToTable("Players");
-                });
-
-            modelBuilder.Entity("Domain.Weapons.Weapon", b =>
-                {
-                    b.Property<int>("Id")
-                        .ValueGeneratedOnAdd()
-                        .HasColumnType("int");
-
-                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
-
-                    b.Property<string>("At")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<string>("Attribute")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<DateTime>("CreatedDate")
-                        .HasColumnType("datetime2");
-
-                    b.Property<string>("GPE")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<string>("Mode")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<DateTime>("ModifiedDate")
-                        .HasColumnType("datetime2");
-
-                    b.Property<string>("Name")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<int>("Pene")
-                        .HasColumnType("int");
-
-                    b.Property<int>("Range")
-                        .HasColumnType("int");
-
-                    b.Property<string>("Rch")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<string>("Type")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.HasKey("Id");
-
-                    b.ToTable("Weapons");
-                });
-
-            modelBuilder.Entity("PlayerWeapon", b =>
-                {
-                    b.Property<int>("PlayersId")
-                        .HasColumnType("int");
-
-                    b.Property<int>("WeaponsId")
-                        .HasColumnType("int");
-
-                    b.HasKey("PlayersId", "WeaponsId");
-
-                    b.HasIndex("WeaponsId");
-
-                    b.ToTable("PlayerWeapon");
-                });
-
-            modelBuilder.Entity("PlayerWeapon", b =>
-                {
-                    b.HasOne("Domain.Player", null)
-                        .WithMany()
-                        .HasForeignKey("PlayersId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-
-                    b.HasOne("Domain.Weapons.Weapon", null)
-                        .WithMany()
-                        .HasForeignKey("WeaponsId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-#pragma warning restore 612, 618
-        }
-    }
-}

+ 1 - 1
Dotnet/Deathwatch/Deathwatch.csproj.user

@@ -4,7 +4,7 @@
     <ActiveDebugProfile>Container (Dockerfile)</ActiveDebugProfile>
     <RazorPage_SelectedScaffolderID>RazorPageScaffolder</RazorPage_SelectedScaffolderID>
     <RazorPage_SelectedScaffolderCategoryPath>root/Common/RazorPage</RazorPage_SelectedScaffolderCategoryPath>
-    <NameOfLastUsedPublishProfile>C:\Users\FlorianMorel\Source\Repos\Warhammer\Dotnet\Deathwatch\Properties\PublishProfiles\deathwatchweb - Web Deploy.pubxml</NameOfLastUsedPublishProfile>
+    <NameOfLastUsedPublishProfile>deathwatchweb - Web Deploy</NameOfLastUsedPublishProfile>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
     <DebuggerFlavor>ProjectDebugger</DebuggerFlavor>

+ 12 - 0
Dotnet/Services/DiceService.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Services
+{
+    public class DiceService
+    {
+    }
+}