Commit Debut de rework

This commit is contained in:
2022-03-19 22:54:55 +01:00
parent aebc60d17f
commit ab02d292da
24 changed files with 234 additions and 212 deletions

View File

@@ -1,4 +1,5 @@
using LaDOSE.Entity.Challonge;
using LaDOSE.Entity.Wordpress;
using Microsoft.EntityFrameworkCore;
@@ -8,19 +9,25 @@ namespace LaDOSE.Entity.Context
{
public DbSet<Game> Game { get; set; }
public DbSet<ApplicationUser> ApplicationUser { get; set; }
public DbSet<Season> Season { get; set; }
public DbSet<Event> Event { get; set; }
public DbSet<Todo> Todo { get; set; }
#region WordPress
public DbSet<WPUser> WPUser { get; set; }
public DbSet<WPEvent> WPEvent { get; set; }
public DbSet<WPBooking> WPBooking { get; set; }
#endregion
#region Tournament
public DbSet<Player> Player { get; set; }
public DbSet<Event> Event { get; set; }
public DbSet<Tournament> Tournament { get; set; }
public DbSet<Result> Result { get; set; }
#endregion
public DbSet<SeasonGame> SeasonGame { get; set; }
public DbSet<EventGame> EventGame { get; set; }
public DbSet<ChallongeParticipent> ChallongeParticipent { get; set; }
public DbSet<ChallongeTournament> ChallongeTournament { get; set; }
@@ -36,43 +43,43 @@ namespace LaDOSE.Entity.Context
modelBuilder.Entity<Event>()
.HasOne(s => s.Season)
.WithMany(p => p.Event)
.HasForeignKey(fk => fk.SeasonId);
//modelBuilder.Entity<Event>()
// .HasOne(s => s.Season)
// .WithMany(p => p.Event)
// .HasForeignKey(fk => fk.SeasonId);
#region SeasonGame
modelBuilder.Entity<SeasonGame>()
.HasKey(t => new { t.SeasonId, t.GameId });
//#region SeasonGame
//modelBuilder.Entity<SeasonGame>()
// .HasKey(t => new { t.SeasonId, t.GameId });
modelBuilder.Entity<SeasonGame>()
.HasOne(pt => pt.Season)
.WithMany(p => p.Games)
.HasForeignKey(pt => pt.SeasonId);
//modelBuilder.Entity<SeasonGame>()
// .HasOne(pt => pt.Season)
// .WithMany(p => p.Games)
// .HasForeignKey(pt => pt.SeasonId);
modelBuilder.Entity<SeasonGame>()
.HasOne(pt => pt.Game)
.WithMany(p => p.Seasons)
.HasForeignKey(pt => pt.GameId);
#endregion
//modelBuilder.Entity<SeasonGame>()
// .HasOne(pt => pt.Game)
// .WithMany(p => p.Seasons)
// .HasForeignKey(pt => pt.GameId);
//#endregion
#region EventGame
//#region EventGame
modelBuilder.Entity<EventGame>()
.HasKey(t => new { t.EventId, t.GameId });
//modelBuilder.Entity<EventGame>()
// .HasKey(t => new { t.EventId, t.GameId });
modelBuilder.Entity<EventGame>()
.HasOne(pt => pt.Event)
.WithMany(p => p.Games)
.HasForeignKey(pt => pt.EventId);
//modelBuilder.Entity<EventGame>()
// .HasOne(pt => pt.Event)
// .WithMany(p => p.Games)
// .HasForeignKey(pt => pt.EventId);
modelBuilder.Entity<EventGame>()
.HasOne(pt => pt.Game)
.WithMany(p => p.Events)
.HasForeignKey(pt => pt.GameId);
#endregion
//modelBuilder.Entity<EventGame>()
// .HasOne(pt => pt.Game)
// .WithMany(p => p.Events)
// .HasForeignKey(pt => pt.GameId);
//#endregion
#region WordPress WPBooking