Sequence/DbContext.cs

35 lines
948 B
C#
Raw Normal View History

2023-04-04 01:56:57 +00:00
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Sequence.Entities;
public class DbContext : IdentityDbContext<User, IdentityRole<Guid>, Guid>
{
public DbContext(DbContextOptions<DbContext> options) : base(options) { }
2023-04-05 01:58:24 +00:00
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
var deck = CardUtility.GenerateDeck();
var players = new Player[]
{
new Player
{
Id = Guid.NewGuid(),
}
};
modelBuilder.Entity<Card>().HasData(deck);
//modelBuilder.Entity<Player>().HasData()
}
2023-04-05 02:47:05 +00:00
public DbSet<Card> Cards { get; set; }
2023-04-05 01:58:24 +00:00
public DbSet<PlayerCard> PlayerCards { get; set; }
public DbSet<Match> Matches { get; set; }
public DbSet<Player> Players { get; set; }
2023-04-04 02:15:48 +00:00
2023-04-04 01:56:57 +00:00
}