2022-08-18 22:59:13 +03:00
|
|
|
using BlueWest.Data;
|
2022-08-22 00:14:50 +03:00
|
|
|
using BlueWest.WebApi.EF.Model;
|
2022-08-18 22:59:13 +03:00
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
2022-08-22 00:14:50 +03:00
|
|
|
namespace BlueWest.WebApi.EF
|
2022-08-18 22:59:13 +03:00
|
|
|
{
|
2022-08-19 02:02:57 +03:00
|
|
|
/// <summary>
|
|
|
|
/// Finance operations table
|
|
|
|
/// </summary>
|
2022-08-22 00:14:50 +03:00
|
|
|
internal sealed class FinanceDbContext : DbContext
|
2022-08-18 22:59:13 +03:00
|
|
|
{
|
2022-08-22 00:14:50 +03:00
|
|
|
[DatabaseFundamentals(typeof(FinanceDbContext), typeof(FinanceOp))]
|
|
|
|
internal DbSet<FinanceOp> Transactions { get; set; }
|
2022-08-20 05:47:32 +03:00
|
|
|
|
2022-08-22 00:14:50 +03:00
|
|
|
[DatabaseFundamentals(typeof(FinanceDbContext), typeof(FinanceOpType))]
|
|
|
|
internal DbSet<FinanceOpType> TransactionTypes { get; set; }
|
2022-08-19 06:18:50 +03:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Finance transactions context
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="options"></param>
|
2022-08-22 00:14:50 +03:00
|
|
|
internal FinanceDbContext(DbContextOptions<FinanceDbContext> options) : base(options)
|
2022-08-19 02:02:57 +03:00
|
|
|
{
|
|
|
|
Database.EnsureCreated();
|
|
|
|
}
|
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-08-18 22:59:13 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|