2019-08-06 01:56:33 +02:00
|
|
|
|
using LaDOSE.Entity.Challonge;
|
2022-03-19 22:54:55 +01:00
|
|
|
|
|
2019-08-06 01:56:33 +02:00
|
|
|
|
using LaDOSE.Entity.Wordpress;
|
2018-10-08 23:33:18 +02:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
2018-10-06 13:05:38 +02:00
|
|
|
|
|
|
|
|
|
|
namespace LaDOSE.Entity.Context
|
2018-10-05 00:18:37 +02:00
|
|
|
|
{
|
|
|
|
|
|
public class LaDOSEDbContext : DbContext
|
|
|
|
|
|
{
|
|
|
|
|
|
public DbSet<Game> Game { get; set; }
|
2018-10-05 01:51:23 +02:00
|
|
|
|
public DbSet<ApplicationUser> ApplicationUser { get; set; }
|
2022-03-19 22:54:55 +01:00
|
|
|
|
|
2019-03-27 00:37:11 +01:00
|
|
|
|
public DbSet<Todo> Todo { get; set; }
|
2018-10-08 23:33:18 +02:00
|
|
|
|
|
|
|
|
|
|
#region WordPress
|
|
|
|
|
|
public DbSet<WPUser> WPUser { get; set; }
|
|
|
|
|
|
public DbSet<WPEvent> WPEvent { get; set; }
|
|
|
|
|
|
public DbSet<WPBooking> WPBooking { get; set; }
|
2022-03-19 22:54:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#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; }
|
2018-10-08 23:33:18 +02:00
|
|
|
|
|
|
|
|
|
|
#endregion
|
2019-08-06 01:56:33 +02:00
|
|
|
|
public DbSet<ChallongeParticipent> ChallongeParticipent { get; set; }
|
|
|
|
|
|
public DbSet<ChallongeTournament> ChallongeTournament { get; set; }
|
2018-10-05 00:18:37 +02:00
|
|
|
|
|
|
|
|
|
|
public LaDOSEDbContext(DbContextOptions options) : base(options)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
|
|
|
|
{
|
2018-10-06 14:16:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
2018-10-05 00:18:37 +02:00
|
|
|
|
base.OnModelCreating(modelBuilder);
|
2018-10-08 23:33:18 +02:00
|
|
|
|
|
2018-10-06 14:16:42 +02:00
|
|
|
|
|
2018-10-08 23:33:18 +02:00
|
|
|
|
|
2022-03-19 22:54:55 +01:00
|
|
|
|
//modelBuilder.Entity<Event>()
|
|
|
|
|
|
// .HasOne(s => s.Season)
|
|
|
|
|
|
// .WithMany(p => p.Event)
|
|
|
|
|
|
// .HasForeignKey(fk => fk.SeasonId);
|
2018-10-06 14:16:42 +02:00
|
|
|
|
|
2018-10-22 01:13:42 +02:00
|
|
|
|
|
2018-10-07 15:15:11 +02:00
|
|
|
|
|
2022-03-19 22:54:55 +01:00
|
|
|
|
//#region SeasonGame
|
|
|
|
|
|
//modelBuilder.Entity<SeasonGame>()
|
|
|
|
|
|
// .HasKey(t => new { t.SeasonId, t.GameId });
|
2018-10-07 15:15:11 +02:00
|
|
|
|
|
2022-03-19 22:54:55 +01:00
|
|
|
|
//modelBuilder.Entity<SeasonGame>()
|
|
|
|
|
|
// .HasOne(pt => pt.Season)
|
|
|
|
|
|
// .WithMany(p => p.Games)
|
|
|
|
|
|
// .HasForeignKey(pt => pt.SeasonId);
|
2018-10-06 14:16:42 +02:00
|
|
|
|
|
2022-03-19 22:54:55 +01:00
|
|
|
|
//modelBuilder.Entity<SeasonGame>()
|
|
|
|
|
|
// .HasOne(pt => pt.Game)
|
|
|
|
|
|
// .WithMany(p => p.Seasons)
|
|
|
|
|
|
// .HasForeignKey(pt => pt.GameId);
|
|
|
|
|
|
//#endregion
|
2018-10-06 14:16:42 +02:00
|
|
|
|
|
2022-03-19 22:54:55 +01:00
|
|
|
|
//#region EventGame
|
2018-10-08 23:33:18 +02:00
|
|
|
|
|
2022-03-19 22:54:55 +01:00
|
|
|
|
//modelBuilder.Entity<EventGame>()
|
|
|
|
|
|
// .HasKey(t => new { t.EventId, t.GameId });
|
2018-10-07 15:15:11 +02:00
|
|
|
|
|
2022-03-19 22:54:55 +01:00
|
|
|
|
//modelBuilder.Entity<EventGame>()
|
|
|
|
|
|
// .HasOne(pt => pt.Event)
|
|
|
|
|
|
// .WithMany(p => p.Games)
|
|
|
|
|
|
// .HasForeignKey(pt => pt.EventId);
|
2018-10-07 15:15:11 +02:00
|
|
|
|
|
2022-03-19 22:54:55 +01:00
|
|
|
|
//modelBuilder.Entity<EventGame>()
|
|
|
|
|
|
// .HasOne(pt => pt.Game)
|
|
|
|
|
|
// .WithMany(p => p.Events)
|
|
|
|
|
|
// .HasForeignKey(pt => pt.GameId);
|
|
|
|
|
|
//#endregion
|
2018-10-08 23:33:18 +02:00
|
|
|
|
|
|
|
|
|
|
#region WordPress WPBooking
|
|
|
|
|
|
|
|
|
|
|
|
modelBuilder.Entity<WPBooking>()
|
|
|
|
|
|
.HasKey(t => new { t.WPEventId, t.WPUserId });
|
|
|
|
|
|
|
|
|
|
|
|
modelBuilder.Entity<WPBooking>()
|
|
|
|
|
|
.HasOne(pt => pt.WPEvent)
|
|
|
|
|
|
.WithMany(p => p.WPBookings)
|
|
|
|
|
|
.HasForeignKey(pt => pt.WPEventId);
|
|
|
|
|
|
|
|
|
|
|
|
modelBuilder.Entity<WPBooking>()
|
|
|
|
|
|
.HasOne(pt => pt.WPUser)
|
|
|
|
|
|
.WithMany(p => p.WPBookings)
|
|
|
|
|
|
.HasForeignKey(pt => pt.WPUserId);
|
|
|
|
|
|
#endregion
|
2018-10-07 15:15:11 +02:00
|
|
|
|
|
2019-08-06 01:56:33 +02:00
|
|
|
|
#region Challonge
|
|
|
|
|
|
modelBuilder.Entity<ChallongeParticipent>()
|
|
|
|
|
|
.HasOne(pt => pt.ChallongeTournament)
|
|
|
|
|
|
.WithMany(p => p.Participents)
|
|
|
|
|
|
.HasForeignKey(pt => pt.ChallongeTournamentId);
|
|
|
|
|
|
#endregion
|
2018-10-05 00:18:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-10-06 13:05:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
2018-10-05 00:18:37 +02:00
|
|
|
|
}
|