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

43 lines
1.2 KiB
C#

using BlueWest.Data;
using BlueWest.WebApi.EF.Model;
using Microsoft.EntityFrameworkCore;
namespace BlueWest.WebApi.EF
{
/// <summary>
/// Finance operations table
/// </summary>
public sealed class FinanceDbContext : DbContext
{
/// <summary>
/// Table storing transactions
/// </summary>
public DbSet<FinanceOp> Transactions { get; set; }
/// <summary>
/// Table storing transaction types.
/// </summary>
public DbSet<FinanceOpType> TransactionTypes { get; set; }
/// <summary>
/// CompanyDbContext constructor.
/// </summary>
/// <param name="options"></param>
public FinanceDbContext(DbContextOptions<FinanceDbContext> 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();
}
}
}