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

37 lines
891 B
C#

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();
}
}
}