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

37 lines
891 B
C#
Raw Normal View History

2022-08-22 00:14:50 +03:00
using BlueWest.Data;
using BlueWest.WebApi.EF.Model;
using MapTo;
using Microsoft.EntityFrameworkCore;
namespace BlueWest.WebApi.EF
{
internal sealed class CompanyDbContext : DbContext
{
public DbSet<Company> Companies { get; set; }
public DbSet<Industry> Industries { get; set; }
public DbSet<Product> Products { get; set; }
/// <summary>
/// Options to be injected in the app
/// </summary>
/// <param name="options"></param>
public CompanyDbContext(DbContextOptions<CompanyDbContext> options) : base(options)
{
Database.EnsureCreated();
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ConfigureCurrentDbModel();
}
}
}