migration succesfull
This commit is contained in:
61
Apollon.EntityFramework/Migrations/20220820005557_initial.Designer.cs
generated
Normal file
61
Apollon.EntityFramework/Migrations/20220820005557_initial.Designer.cs
generated
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Apollon.EntityFramework;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Apollon.EntityFramework.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(TournamentsDbContext))]
|
||||||
|
[Migration("20220820005557_initial")]
|
||||||
|
partial class initial
|
||||||
|
{
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "6.0.8")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Apollon.EntityFramework.DTOs.TournamentDto", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Competition")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("EndDate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("Location")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Organisation")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("Rounds")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("StartDate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("TournamentName")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Tournaments");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
37
Apollon.EntityFramework/Migrations/20220820005557_initial.cs
Normal file
37
Apollon.EntityFramework/Migrations/20220820005557_initial.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Apollon.EntityFramework.Migrations
|
||||||
|
{
|
||||||
|
public partial class initial : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Tournaments",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
Organisation = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
|
TournamentName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
|
Competition = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
|
StartDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
EndDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
Location = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
|
Rounds = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Tournaments", x => x.Id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Tournaments");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Apollon.EntityFramework;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Apollon.EntityFramework.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(TournamentsDbContext))]
|
||||||
|
partial class TournamentsDbContextModelSnapshot : ModelSnapshot
|
||||||
|
{
|
||||||
|
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "6.0.8")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Apollon.EntityFramework.DTOs.TournamentDto", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Competition")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("EndDate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("Location")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Organisation")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("Rounds")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("StartDate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("TournamentName")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Tournaments");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Apollon.EntityFramework
|
|
||||||
{
|
|
||||||
public class TournamentsDbContextFactory
|
|
||||||
{
|
|
||||||
private readonly DbContextOptions _options;
|
|
||||||
|
|
||||||
public TournamentsDbContextFactory(DbContextOptions options)
|
|
||||||
{
|
|
||||||
_options = options;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TournamentsDbContext Create()
|
|
||||||
{
|
|
||||||
return new TournamentsDbContext(_options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Design;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Apollon.EntityFramework
|
||||||
|
{
|
||||||
|
public class TournamentsDesignTimeDbContextFactory : IDesignTimeDbContextFactory<TournamentsDbContext>
|
||||||
|
{
|
||||||
|
|
||||||
|
public TournamentsDbContext CreateDbContext(string[] args = null)
|
||||||
|
{
|
||||||
|
return new TournamentsDbContext(new DbContextOptionsBuilder().UseSqlServer("Data Source=NATHALIE-PC\\NATLINUXDB;Database=Apollon;Trusted_Connection=True;MultipleActiveResultSets=true").Options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -34,7 +34,7 @@ namespace Apollon.WPF
|
|||||||
|
|
||||||
public App()
|
public App()
|
||||||
{
|
{
|
||||||
string connectionString = "Data Source=NATHALIE-PC\\NATLINUXDB;Database=Apollon;Trusted_Connection=True;MultipleActiveResultSets=true";
|
string connectionString = "Server=NATHALIE-PC\\NATLINUXDB;Database=Apollon;Trusted_Connection=True;MultipleActiveResultSets=true";
|
||||||
|
|
||||||
_modalNavigationStore = new ModalNavigationStore();
|
_modalNavigationStore = new ModalNavigationStore();
|
||||||
_tournamentsDbContextFactory = new TournamentsDbContextFactory(
|
_tournamentsDbContextFactory = new TournamentsDbContextFactory(
|
||||||
@@ -48,6 +48,11 @@ namespace Apollon.WPF
|
|||||||
}
|
}
|
||||||
protected override void OnStartup(StartupEventArgs e)
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
{
|
{
|
||||||
|
using(TournamentsDbContext context = _tournamentsDbContextFactory.Create())
|
||||||
|
{
|
||||||
|
context.Database.Migrate();
|
||||||
|
}
|
||||||
|
|
||||||
OverviewViewModel overviewViewModel = new OverviewViewModel(
|
OverviewViewModel overviewViewModel = new OverviewViewModel(
|
||||||
_tournamentStore,
|
_tournamentStore,
|
||||||
_selectedTournamentStore,
|
_selectedTournamentStore,
|
||||||
|
|||||||
Reference in New Issue
Block a user