CodeLiturgy.Dashboard/BlueWest.Domain/FinanceDbContext.cs

57 lines
1.3 KiB
C#
Raw Normal View History

2022-08-18 22:59:13 +03:00
using BlueWest.Data;
2022-09-19 05:50:15 +03:00
using BlueWest.Domain.Model;
2022-08-18 22:59:13 +03:00
using Microsoft.EntityFrameworkCore;
2022-09-19 05:50:15 +03:00
namespace BlueWest.Domain
2022-08-18 22:59:13 +03:00
{
2022-08-19 02:02:57 +03:00
/// <summary>
/// Finance operations table
/// </summary>
2022-08-22 02:51:45 +03:00
public sealed class FinanceDbContext : DbContext
2022-08-18 22:59:13 +03:00
{
2022-09-08 06:15:44 +03:00
#region Transactions
2022-08-22 02:51:45 +03:00
/// <summary>
/// Table storing transactions
/// </summary>
public DbSet<FinanceOp> Transactions { get; set; }
2022-09-08 06:15:44 +03:00
#endregion
#region TransactionType
2022-08-22 02:51:45 +03:00
/// <summary>
/// Table storing transaction types.
/// </summary>
public DbSet<FinanceOpType> TransactionTypes { get; set; }
2022-09-08 06:15:44 +03:00
#endregion
#region Initialization
2022-08-19 06:18:50 +03:00
/// <summary>
/// CompanyDbContext constructor.
2022-08-19 06:18:50 +03:00
/// </summary>
/// <param name="options"></param>
2022-08-22 02:51:45 +03:00
public FinanceDbContext(DbContextOptions<FinanceDbContext> options) : base(options)
2022-08-19 02:02:57 +03:00
{
Database.EnsureCreated();
}
2022-08-22 02:51:45 +03:00
/// <summary>
/// On model creating.
2022-08-22 02:51:45 +03:00
/// </summary>
/// <param name="modelBuilder">Builder model of the database</param>
2022-08-19 06:18:50 +03:00
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
2022-08-20 05:47:32 +03:00
modelBuilder.ConfigureCurrentDbModel();
2022-08-19 06:18:50 +03:00
}
2022-09-08 06:15:44 +03:00
#endregion
2022-08-18 22:59:13 +03:00
}
}