using BlueWest.Data;
using BlueWest.WebApi.EF.Model;
using MapTo;
using Microsoft.EntityFrameworkCore;
namespace BlueWest.WebApi.EF
{
///
/// Context for accessing company data
///
public sealed class CompanyDbContext : DbContext
{
///
/// Db set of Companies
///
public DbSet Companies { get; set; }
///
/// Db set of Industries.
///
public DbSet Industries { get; set; }
///
/// Db set of Products.
///
public DbSet Products { get; set; }
///
/// Options to be injected in the app
///
///
public CompanyDbContext(DbContextOptions options) : base(options)
{
Database.EnsureCreated();
}
///
/// On database model creating
///
/// Builder model of the database
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ConfigureCurrentDbModel();
}
}
}