45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
using BlueWest.Data;
|
|
using CodeLiturgy.Domain.Model;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
namespace CodeLiturgy.Domain
|
|
{
|
|
|
|
/// <summary>
|
|
/// Database context for app users
|
|
/// </summary>
|
|
public sealed class UserDbContext : DbContext
|
|
{
|
|
/// <summary>
|
|
/// Users entity.
|
|
/// </summary>
|
|
public DbSet<User> Users { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// App configuration.
|
|
/// </summary>
|
|
public IConfiguration Configuration;
|
|
|
|
/// <summary>
|
|
/// Database for the context of database users
|
|
/// </summary>
|
|
/// <param name="options"></param>
|
|
public UserDbContext(DbContextOptions<UserDbContext> options) : base(options)
|
|
{
|
|
Database.EnsureCreated();
|
|
}
|
|
|
|
/// <summary>
|
|
/// On model creating.
|
|
/// </summary>
|
|
/// <param name="modelBuilder">Builder model of the database</param>
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
base.OnModelCreating(modelBuilder);
|
|
modelBuilder.ConfigureCurrentDbModel();
|
|
}
|
|
}
|
|
}
|