2022-08-18 22:59:13 +03:00
|
|
|
using BlueWest.Data;
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
namespace BlueWest.WebApi.MySQL
|
|
|
|
{
|
2022-08-19 02:02:57 +03:00
|
|
|
/// <summary>
|
|
|
|
/// Finance operations table
|
|
|
|
/// </summary>
|
|
|
|
public class FinanceDbContext : DbContext
|
2022-08-18 22:59:13 +03:00
|
|
|
{
|
|
|
|
public DbSet<FinanceOp> Transactions { get; set; }
|
|
|
|
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);
|
|
|
|
modelBuilder.ProjectDatabaseModel();
|
|
|
|
}
|
2022-08-18 22:59:13 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|