CodeLiturgy.Dashboard/BlueWest.Domain/FinanceDbContext.cs

57 lines
1.3 KiB
C#

using BlueWest.Data;
using BlueWest.Domain.Model;
using Microsoft.EntityFrameworkCore;
namespace BlueWest.Domain
{
/// <summary>
/// Finance operations table
/// </summary>
public sealed class FinanceDbContext : DbContext
{
#region Transactions
/// <summary>
/// Table storing transactions
/// </summary>
public DbSet<FinanceOp> Transactions { get; set; }
#endregion
#region TransactionType
/// <summary>
/// Table storing transaction types.
/// </summary>
public DbSet<FinanceOpType> TransactionTypes { get; set; }
#endregion
#region Initialization
/// <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();
}
#endregion
}
}