ดิงข้อมูลหลักจาก dbกลาง
This commit is contained in:
parent
2f292d25ca
commit
4e8520eb01
44 changed files with 4642 additions and 2590 deletions
55
Data/MetadataDbContext.cs
Normal file
55
Data/MetadataDbContext.cs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
using BMA.EHR.Recurit.Exam.Service.Models;
|
||||
using BMA.EHR.Recurit.Exam.Service.Models.Documents;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Recurit.Exam.Service.Data
|
||||
{
|
||||
public class MetadataDbContext : DbContext
|
||||
{
|
||||
public MetadataDbContext(DbContextOptions<MetadataDbContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
}
|
||||
|
||||
// The following configures EF to create a Sqlite database file in the
|
||||
// special "local" folder for your platform.
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
||||
{
|
||||
if (!options.IsConfigured)
|
||||
{
|
||||
var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production";
|
||||
var configurationBuilder = new ConfigurationBuilder()
|
||||
.AddJsonFile("appsettings.json", optional: true, true)
|
||||
.AddJsonFile($"appsettings.{environment}.json", true, true)
|
||||
.AddEnvironmentVariables()
|
||||
.Build();
|
||||
|
||||
var historyConnection = configurationBuilder.GetConnectionString("HistoryConnection");
|
||||
options.UseMySql(historyConnection, ServerVersion.AutoDetect(historyConnection));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public DbSet<Prefix> Prefixes { get; set; }
|
||||
|
||||
public DbSet<Religion> Religions { get; set; }
|
||||
|
||||
public DbSet<EducationLevel> EducationLevels { get; set; }
|
||||
|
||||
public DbSet<Relationship> Relationships { get; set; }
|
||||
|
||||
public DbSet<Province> Provinces { get; set; }
|
||||
|
||||
public DbSet<District> Districts { get; set; }
|
||||
|
||||
public DbSet<SubDistrict> SubDistricts { get; set; }
|
||||
|
||||
public DbSet<OrganizationOrganization> OrganizationOrganizations { get; set; }
|
||||
|
||||
public DbSet<OrganizationShortName> OrganizationShortNames { get; set; }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue