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

33 lines
877 B
C#
Raw Normal View History

2022-08-18 22:59:13 +03:00
using BlueWest.Data;
2022-08-20 05:47:32 +03:00
using BlueWest.WebApi.MySQL.Model;
2022-08-18 22:59:13 +03:00
using Microsoft.EntityFrameworkCore;
namespace BlueWest.WebApi.MySQL
{
2022-08-19 02:02:57 +03:00
/// <summary>
/// Finance operations table
/// </summary>
2022-08-20 05:47:32 +03:00
public sealed class FinanceDbContext : DbContext
2022-08-18 22:59:13 +03:00
{
public DbSet<FinanceOp> Transactions { get; set; }
2022-08-20 05:47:32 +03:00
2022-08-18 22:59:13 +03:00
public DbSet<FinanceOpType> TransactionTypes { get; set; }
2022-08-19 06:18:50 +03:00
/// <summary>
/// Finance transactions context
/// </summary>
/// <param name="options"></param>
public 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
}
}