CodeLiturgy.Dashboard/BlueWest.Api/Context/FinanceDbContext.cs

35 lines
1.0 KiB
C#

using BlueWest.Data;
using BlueWest.WebApi.EF.Model;
using Microsoft.EntityFrameworkCore;
namespace BlueWest.WebApi.EF
{
/// <summary>
/// Finance operations table
/// </summary>
internal sealed class FinanceDbContext : DbContext
{
[DatabaseFundamentals(typeof(FinanceDbContext), typeof(FinanceOp))]
internal DbSet<FinanceOp> Transactions { get; set; }
[DatabaseFundamentals(typeof(FinanceDbContext), typeof(FinanceOpType))]
internal DbSet<FinanceOpType> TransactionTypes { get; set; }
/// <summary>
/// Finance transactions context
/// </summary>
/// <param name="options"></param>
internal FinanceDbContext(DbContextOptions<FinanceDbContext> options) : base(options)
{
Database.EnsureCreated();
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ConfigureCurrentDbModel();
}
}
}