Övergått till entity framework + lagt till ny tabell

This commit is contained in:
2025-09-02 15:07:21 +02:00
parent b04fc7e06e
commit ddb6719587
22 changed files with 1175 additions and 95 deletions

View File

@ -0,0 +1,70 @@
// <auto-generated />
using GreadyPoang.DataLayer.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GreadyPoang.DataLayer.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20250901152226_initialCreate")]
partial class initialCreate
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "9.0.8");
modelBuilder.Entity("GreadyPoang.EntityLayer.Participant", b =>
{
b.Property<int>("ParticipantId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("ParticipantId");
b.ToTable("Participants");
b.HasData(
new
{
ParticipantId = 1,
Email = "John.Doe@gmail.com",
FirstName = "John",
LastName = "Doe"
},
new
{
ParticipantId = 2,
Email = "jb@gmail.com",
FirstName = "Jane",
LastName = "Black"
},
new
{
ParticipantId = 3,
Email = "mw@gmail.com",
FirstName = "Mary",
LastName = "White"
});
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,48 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace GreadyPoang.DataLayer.Migrations
{
/// <inheritdoc />
public partial class initialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Participants",
columns: table => new
{
ParticipantId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
FirstName = table.Column<string>(type: "TEXT", nullable: false),
LastName = table.Column<string>(type: "TEXT", nullable: false),
Email = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Participants", x => x.ParticipantId);
});
migrationBuilder.InsertData(
table: "Participants",
columns: new[] { "ParticipantId", "Email", "FirstName", "LastName" },
values: new object[,]
{
{ 1, "John.Doe@gmail.com", "John", "Doe" },
{ 2, "jb@gmail.com", "Jane", "Black" },
{ 3, "mw@gmail.com", "Mary", "White" }
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Participants");
}
}
}

View File

@ -0,0 +1,135 @@
// <auto-generated />
using System;
using GreadyPoang.DataLayer.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GreadyPoang.DataLayer.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20250902115700_GamePointsTable")]
partial class GamePointsTable
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "9.0.8");
modelBuilder.Entity("GreadyPoang.EntityLayer.GamePoint", b =>
{
b.Property<int>("GamePointId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("GameDate")
.HasColumnType("TEXT");
b.Property<int>("GameHeatId")
.HasColumnType("INTEGER");
b.Property<int>("GameHeatRegNr")
.HasColumnType("INTEGER");
b.Property<int>("GameRegPoints")
.HasColumnType("INTEGER");
b.Property<int>("ParticipantId")
.HasColumnType("INTEGER");
b.HasKey("GamePointId");
b.ToTable("GamePoints");
b.HasData(
new
{
GamePointId = 1,
GameDate = new DateTime(2025, 9, 2, 13, 56, 59, 539, DateTimeKind.Local).AddTicks(8341),
GameHeatId = 0,
GameHeatRegNr = 1,
GameRegPoints = 1050,
ParticipantId = 1
},
new
{
GamePointId = 2,
GameDate = new DateTime(2025, 9, 2, 13, 56, 59, 539, DateTimeKind.Local).AddTicks(8923),
GameHeatId = 0,
GameHeatRegNr = 3,
GameRegPoints = 350,
ParticipantId = 1
},
new
{
GamePointId = 3,
GameDate = new DateTime(2025, 9, 2, 13, 56, 59, 539, DateTimeKind.Local).AddTicks(8927),
GameHeatId = 0,
GameHeatRegNr = 2,
GameRegPoints = 1000,
ParticipantId = 3
},
new
{
GamePointId = 4,
GameDate = new DateTime(2025, 9, 2, 13, 56, 59, 539, DateTimeKind.Local).AddTicks(8929),
GameHeatId = 0,
GameHeatRegNr = 4,
GameRegPoints = 400,
ParticipantId = 3
});
});
modelBuilder.Entity("GreadyPoang.EntityLayer.Participant", b =>
{
b.Property<int>("ParticipantId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("ParticipantId");
b.ToTable("Participants");
b.HasData(
new
{
ParticipantId = 1,
Email = "John.Doe@gmail.com",
FirstName = "John",
LastName = "Doe"
},
new
{
ParticipantId = 2,
Email = "jb@gmail.com",
FirstName = "Jane",
LastName = "Black"
},
new
{
ParticipantId = 3,
Email = "mw@gmail.com",
FirstName = "Mary",
LastName = "White"
});
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,52 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace GreadyPoang.DataLayer.Migrations
{
/// <inheritdoc />
public partial class GamePointsTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "GamePoints",
columns: table => new
{
GamePointId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ParticipantId = table.Column<int>(type: "INTEGER", nullable: false),
GameHeatId = table.Column<int>(type: "INTEGER", nullable: false),
GameDate = table.Column<DateTime>(type: "TEXT", nullable: false),
GameHeatRegNr = table.Column<int>(type: "INTEGER", nullable: false),
GameRegPoints = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GamePoints", x => x.GamePointId);
});
migrationBuilder.InsertData(
table: "GamePoints",
columns: new[] { "GamePointId", "GameDate", "GameHeatId", "GameHeatRegNr", "GameRegPoints", "ParticipantId" },
values: new object[,]
{
{ 1, new DateTime(2025, 9, 2, 13, 56, 59, 539, DateTimeKind.Local).AddTicks(8341), 0, 1, 1050, 1 },
{ 2, new DateTime(2025, 9, 2, 13, 56, 59, 539, DateTimeKind.Local).AddTicks(8923), 0, 3, 350, 1 },
{ 3, new DateTime(2025, 9, 2, 13, 56, 59, 539, DateTimeKind.Local).AddTicks(8927), 0, 2, 1000, 3 },
{ 4, new DateTime(2025, 9, 2, 13, 56, 59, 539, DateTimeKind.Local).AddTicks(8929), 0, 4, 400, 3 }
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "GamePoints");
}
}
}

View File

@ -0,0 +1,135 @@
// <auto-generated />
using System;
using GreadyPoang.DataLayer.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GreadyPoang.DataLayer.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20250902120934_GamePointsTableStaticSeed")]
partial class GamePointsTableStaticSeed
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "9.0.8");
modelBuilder.Entity("GreadyPoang.EntityLayer.GamePoint", b =>
{
b.Property<int>("GamePointId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("GameDate")
.HasColumnType("TEXT");
b.Property<int>("GameHeatId")
.HasColumnType("INTEGER");
b.Property<int>("GameHeatRegNr")
.HasColumnType("INTEGER");
b.Property<int>("GameRegPoints")
.HasColumnType("INTEGER");
b.Property<int>("ParticipantId")
.HasColumnType("INTEGER");
b.HasKey("GamePointId");
b.ToTable("GamePoints");
b.HasData(
new
{
GamePointId = 1,
GameDate = new DateTime(2025, 9, 2, 14, 9, 34, 269, DateTimeKind.Local).AddTicks(5394),
GameHeatId = 0,
GameHeatRegNr = 1,
GameRegPoints = 1050,
ParticipantId = 1
},
new
{
GamePointId = 2,
GameDate = new DateTime(2025, 9, 2, 14, 9, 34, 269, DateTimeKind.Local).AddTicks(6081),
GameHeatId = 0,
GameHeatRegNr = 3,
GameRegPoints = 350,
ParticipantId = 1
},
new
{
GamePointId = 3,
GameDate = new DateTime(2025, 9, 2, 14, 9, 34, 269, DateTimeKind.Local).AddTicks(6085),
GameHeatId = 0,
GameHeatRegNr = 2,
GameRegPoints = 1000,
ParticipantId = 3
},
new
{
GamePointId = 4,
GameDate = new DateTime(2025, 9, 2, 14, 9, 34, 269, DateTimeKind.Local).AddTicks(6088),
GameHeatId = 0,
GameHeatRegNr = 4,
GameRegPoints = 400,
ParticipantId = 3
});
});
modelBuilder.Entity("GreadyPoang.EntityLayer.Participant", b =>
{
b.Property<int>("ParticipantId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("ParticipantId");
b.ToTable("Participants");
b.HasData(
new
{
ParticipantId = 1,
Email = "John.Doe@gmail.com",
FirstName = "John",
LastName = "Doe"
},
new
{
ParticipantId = 2,
Email = "jb@gmail.com",
FirstName = "Jane",
LastName = "Black"
},
new
{
ParticipantId = 3,
Email = "mw@gmail.com",
FirstName = "Mary",
LastName = "White"
});
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,75 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GreadyPoang.DataLayer.Migrations
{
/// <inheritdoc />
public partial class GamePointsTableStaticSeed : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "GamePoints",
keyColumn: "GamePointId",
keyValue: 1,
column: "GameDate",
value: new DateTime(2025, 9, 2, 14, 9, 34, 269, DateTimeKind.Local).AddTicks(5394));
migrationBuilder.UpdateData(
table: "GamePoints",
keyColumn: "GamePointId",
keyValue: 2,
column: "GameDate",
value: new DateTime(2025, 9, 2, 14, 9, 34, 269, DateTimeKind.Local).AddTicks(6081));
migrationBuilder.UpdateData(
table: "GamePoints",
keyColumn: "GamePointId",
keyValue: 3,
column: "GameDate",
value: new DateTime(2025, 9, 2, 14, 9, 34, 269, DateTimeKind.Local).AddTicks(6085));
migrationBuilder.UpdateData(
table: "GamePoints",
keyColumn: "GamePointId",
keyValue: 4,
column: "GameDate",
value: new DateTime(2025, 9, 2, 14, 9, 34, 269, DateTimeKind.Local).AddTicks(6088));
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "GamePoints",
keyColumn: "GamePointId",
keyValue: 1,
column: "GameDate",
value: new DateTime(2025, 9, 2, 13, 56, 59, 539, DateTimeKind.Local).AddTicks(8341));
migrationBuilder.UpdateData(
table: "GamePoints",
keyColumn: "GamePointId",
keyValue: 2,
column: "GameDate",
value: new DateTime(2025, 9, 2, 13, 56, 59, 539, DateTimeKind.Local).AddTicks(8923));
migrationBuilder.UpdateData(
table: "GamePoints",
keyColumn: "GamePointId",
keyValue: 3,
column: "GameDate",
value: new DateTime(2025, 9, 2, 13, 56, 59, 539, DateTimeKind.Local).AddTicks(8927));
migrationBuilder.UpdateData(
table: "GamePoints",
keyColumn: "GamePointId",
keyValue: 4,
column: "GameDate",
value: new DateTime(2025, 9, 2, 13, 56, 59, 539, DateTimeKind.Local).AddTicks(8929));
}
}
}

View File

@ -0,0 +1,135 @@
// <auto-generated />
using System;
using GreadyPoang.DataLayer.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GreadyPoang.DataLayer.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20250902122130_FixDateTimeSeed")]
partial class FixDateTimeSeed
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "9.0.8");
modelBuilder.Entity("GreadyPoang.EntityLayer.GamePoint", b =>
{
b.Property<int>("GamePointId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("GameDate")
.HasColumnType("TEXT");
b.Property<int>("GameHeatId")
.HasColumnType("INTEGER");
b.Property<int>("GameHeatRegNr")
.HasColumnType("INTEGER");
b.Property<int>("GameRegPoints")
.HasColumnType("INTEGER");
b.Property<int>("ParticipantId")
.HasColumnType("INTEGER");
b.HasKey("GamePointId");
b.ToTable("GamePoints");
b.HasData(
new
{
GamePointId = 1,
GameDate = new DateTime(2025, 10, 15, 20, 10, 15, 0, DateTimeKind.Unspecified),
GameHeatId = 0,
GameHeatRegNr = 1,
GameRegPoints = 1050,
ParticipantId = 1
},
new
{
GamePointId = 2,
GameDate = new DateTime(2025, 10, 15, 20, 15, 15, 0, DateTimeKind.Unspecified),
GameHeatId = 0,
GameHeatRegNr = 3,
GameRegPoints = 350,
ParticipantId = 1
},
new
{
GamePointId = 3,
GameDate = new DateTime(2025, 10, 15, 20, 12, 15, 0, DateTimeKind.Unspecified),
GameHeatId = 0,
GameHeatRegNr = 2,
GameRegPoints = 1000,
ParticipantId = 3
},
new
{
GamePointId = 4,
GameDate = new DateTime(2025, 10, 15, 20, 20, 15, 0, DateTimeKind.Unspecified),
GameHeatId = 0,
GameHeatRegNr = 4,
GameRegPoints = 400,
ParticipantId = 3
});
});
modelBuilder.Entity("GreadyPoang.EntityLayer.Participant", b =>
{
b.Property<int>("ParticipantId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("ParticipantId");
b.ToTable("Participants");
b.HasData(
new
{
ParticipantId = 1,
Email = "John.Doe@gmail.com",
FirstName = "John",
LastName = "Doe"
},
new
{
ParticipantId = 2,
Email = "jb@gmail.com",
FirstName = "Jane",
LastName = "Black"
},
new
{
ParticipantId = 3,
Email = "mw@gmail.com",
FirstName = "Mary",
LastName = "White"
});
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,75 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GreadyPoang.DataLayer.Migrations
{
/// <inheritdoc />
public partial class FixDateTimeSeed : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "GamePoints",
keyColumn: "GamePointId",
keyValue: 1,
column: "GameDate",
value: new DateTime(2025, 10, 15, 20, 10, 15, 0, DateTimeKind.Unspecified));
migrationBuilder.UpdateData(
table: "GamePoints",
keyColumn: "GamePointId",
keyValue: 2,
column: "GameDate",
value: new DateTime(2025, 10, 15, 20, 15, 15, 0, DateTimeKind.Unspecified));
migrationBuilder.UpdateData(
table: "GamePoints",
keyColumn: "GamePointId",
keyValue: 3,
column: "GameDate",
value: new DateTime(2025, 10, 15, 20, 12, 15, 0, DateTimeKind.Unspecified));
migrationBuilder.UpdateData(
table: "GamePoints",
keyColumn: "GamePointId",
keyValue: 4,
column: "GameDate",
value: new DateTime(2025, 10, 15, 20, 20, 15, 0, DateTimeKind.Unspecified));
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "GamePoints",
keyColumn: "GamePointId",
keyValue: 1,
column: "GameDate",
value: new DateTime(2025, 9, 2, 14, 9, 34, 269, DateTimeKind.Local).AddTicks(5394));
migrationBuilder.UpdateData(
table: "GamePoints",
keyColumn: "GamePointId",
keyValue: 2,
column: "GameDate",
value: new DateTime(2025, 9, 2, 14, 9, 34, 269, DateTimeKind.Local).AddTicks(6081));
migrationBuilder.UpdateData(
table: "GamePoints",
keyColumn: "GamePointId",
keyValue: 3,
column: "GameDate",
value: new DateTime(2025, 9, 2, 14, 9, 34, 269, DateTimeKind.Local).AddTicks(6085));
migrationBuilder.UpdateData(
table: "GamePoints",
keyColumn: "GamePointId",
keyValue: 4,
column: "GameDate",
value: new DateTime(2025, 9, 2, 14, 9, 34, 269, DateTimeKind.Local).AddTicks(6088));
}
}
}

View File

@ -0,0 +1,132 @@
// <auto-generated />
using System;
using GreadyPoang.DataLayer.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GreadyPoang.DataLayer.Migrations
{
[DbContext(typeof(DataContext))]
partial class DataContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "9.0.8");
modelBuilder.Entity("GreadyPoang.EntityLayer.GamePoint", b =>
{
b.Property<int>("GamePointId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("GameDate")
.HasColumnType("TEXT");
b.Property<int>("GameHeatId")
.HasColumnType("INTEGER");
b.Property<int>("GameHeatRegNr")
.HasColumnType("INTEGER");
b.Property<int>("GameRegPoints")
.HasColumnType("INTEGER");
b.Property<int>("ParticipantId")
.HasColumnType("INTEGER");
b.HasKey("GamePointId");
b.ToTable("GamePoints");
b.HasData(
new
{
GamePointId = 1,
GameDate = new DateTime(2025, 10, 15, 20, 10, 15, 0, DateTimeKind.Unspecified),
GameHeatId = 0,
GameHeatRegNr = 1,
GameRegPoints = 1050,
ParticipantId = 1
},
new
{
GamePointId = 2,
GameDate = new DateTime(2025, 10, 15, 20, 15, 15, 0, DateTimeKind.Unspecified),
GameHeatId = 0,
GameHeatRegNr = 3,
GameRegPoints = 350,
ParticipantId = 1
},
new
{
GamePointId = 3,
GameDate = new DateTime(2025, 10, 15, 20, 12, 15, 0, DateTimeKind.Unspecified),
GameHeatId = 0,
GameHeatRegNr = 2,
GameRegPoints = 1000,
ParticipantId = 3
},
new
{
GamePointId = 4,
GameDate = new DateTime(2025, 10, 15, 20, 20, 15, 0, DateTimeKind.Unspecified),
GameHeatId = 0,
GameHeatRegNr = 4,
GameRegPoints = 400,
ParticipantId = 3
});
});
modelBuilder.Entity("GreadyPoang.EntityLayer.Participant", b =>
{
b.Property<int>("ParticipantId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("ParticipantId");
b.ToTable("Participants");
b.HasData(
new
{
ParticipantId = 1,
Email = "John.Doe@gmail.com",
FirstName = "John",
LastName = "Doe"
},
new
{
ParticipantId = 2,
Email = "jb@gmail.com",
FirstName = "Jane",
LastName = "Black"
},
new
{
ParticipantId = 3,
Email = "mw@gmail.com",
FirstName = "Mary",
LastName = "White"
});
});
#pragma warning restore 612, 618
}
}
}