session-companion/SessionCompanion/SessionCompanion.Database/ApplicationDbContext.cs

44 lines
2.0 KiB
C#
Raw Normal View History

using Microsoft.EntityFrameworkCore;
using SessionCompanion.Database.Tables;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SessionCompanion.Database
{
public class ApplicationDbContext : DbContext
{
public virtual DbSet<Alignment> Alignments { get; set; }
public virtual DbSet<Background> Backgrounds { get; set; }
public virtual DbSet<Biography> Biographies { get; set; }
public virtual DbSet<Character> Characters { get; set; }
2020-12-04 15:49:51 +01:00
public virtual DbSet<Charisma> Charismas { get; set; }
public virtual DbSet<Class> Classes { get; set; }
2020-12-04 15:49:51 +01:00
public virtual DbSet<Constitution> Constitutions { get; set; }
public virtual DbSet<Dexterity> Dexterities { get; set; }
public virtual DbSet<Intelligence> Intelligences { get; set; }
public virtual DbSet<Race> Races { get; set; }
public virtual DbSet<Statistics> Statistics { get; set; }
2020-12-04 15:49:51 +01:00
public virtual DbSet<Strength> Strengths { get; set; }
public virtual DbSet<User> Users { get; set; }
2020-12-04 15:49:51 +01:00
public virtual DbSet<Wisdom> Wisdoms { get; set; }
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { }
2020-12-03 17:00:04 +01:00
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
2020-12-03 17:50:11 +01:00
builder.Entity<User>().HasData(SeedData.SeedUsers());
2020-12-18 12:00:36 +01:00
builder.Entity<Character>().HasData(SeedData.SeedCharacter());
builder.Entity<Race>().HasData(SeedData.SeedRace());
builder.Entity<Class>().HasData(SeedData.SeedClass());
builder.Entity<Alignment>().HasData(SeedData.SeedAlignment());
builder.Entity<Background>().HasData(SeedData.SeedBackground());
builder.Entity<Biography>().HasData(SeedData.SeedBiography());
builder.Entity<Statistics>().HasData(SeedData.SeedStatistics());
2020-12-03 17:00:04 +01:00
}
}
}