using BlueWest.Data;
using BlueWest.WebApi.EF.Model;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
namespace BlueWest.WebApi.EF
{
///
/// Countries and Currencies
///
public sealed class CountryDbContext : DbContext
{
///
/// Countries Database Table
///
public DbSet Countries { get; set; }
///
/// Currencies Database Table
///
public DbSet Currencies { get; set; }
///
/// App Configuration
///
public IConfiguration Configuration;
///
/// Options to be injected in the app
///
///
public CountryDbContext(DbContextOptions options) : base(options)
{
Database.EnsureCreated();
}
///
/// The country number is the primary key
/// The currency code is the primary key
///
///
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ConfigureCurrentDbModel();
}
}
}