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

33 lines
877 B
C#

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