2023-06-05 20:22:51 +07:00
|
|
|
|
using BMA.EHR.Application.Common.Interfaces;
|
2023-06-26 14:02:04 +07:00
|
|
|
|
using BMA.EHR.Domain.Models.MetaData;
|
2023-06-05 20:22:51 +07:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
|
|
|
|
namespace BMA.EHR.Infrastructure.Persistence
|
|
|
|
|
|
{
|
2023-06-25 18:36:02 +07:00
|
|
|
|
public class ApplicationDBContext : DbContext, IApplicationDBContext
|
2023-06-26 10:15:50 +07:00
|
|
|
|
{
|
2023-06-26 14:02:04 +07:00
|
|
|
|
#region " From Existing Database "
|
2023-06-05 20:22:51 +07:00
|
|
|
|
|
2023-06-26 14:02:04 +07:00
|
|
|
|
#region " Meta Data "
|
2023-06-05 20:22:51 +07:00
|
|
|
|
|
2023-06-26 14:02:04 +07:00
|
|
|
|
public DbSet<Prefix> Prefixes { get; set; }
|
2023-06-25 18:36:02 +07:00
|
|
|
|
|
2023-06-26 14:02:04 +07:00
|
|
|
|
public DbSet<BloodGroup> BloodGroups { get; set; }
|
2023-06-25 18:36:02 +07:00
|
|
|
|
|
2023-06-26 14:02:04 +07:00
|
|
|
|
public DbSet<Gender> Genders { get; set; }
|
2023-06-25 18:36:02 +07:00
|
|
|
|
|
2023-06-26 14:02:04 +07:00
|
|
|
|
public DbSet<PhysicalStatus> PhysicalStatuses { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<Religion> Religions { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<EducationLevel> EducationLevels { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<PositionPath> PositionPaths { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<PositionType> PositionTypes { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<PositionEmployeePosition> PositionEmployeePositions { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<PositionEmployeePositionSide> PositionEmployeePositionSides { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<PositionEmployeeGroup> PositionEmployeeGroups { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<PositionEmployeeLine> PositionEmployeeLines { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<PositionEmployeeLevel> PositionEmployeeLevels { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<PositionEmployeeStatus> PositionEmployeeStatuses { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<PositionLine> PositionLines { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<PositionExecutive> PositionExecutives { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<PositionStatus> PositionStatuss { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<PositionLevel> PositionLevels { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<Relationship> Relationships { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<Position> Positions { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<PositionPathSide> PositionPathSides { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<PositionExecutiveSide> PositionExecutiveSides { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<InsigniaType> InsigniaTypes { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<Insignia> Insignias { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<Province> Provinces { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<District> Districts { get; set; }
|
2023-06-25 18:36:02 +07:00
|
|
|
|
|
2023-06-26 14:02:04 +07:00
|
|
|
|
public DbSet<SubDistrict> SubDistricts { get; set; }
|
2023-06-25 18:36:02 +07:00
|
|
|
|
|
2023-06-26 14:02:04 +07:00
|
|
|
|
public DbSet<Holiday> Holidays { get; set; }
|
2023-06-25 18:36:02 +07:00
|
|
|
|
|
2023-06-26 14:02:04 +07:00
|
|
|
|
public DbSet<OrganizationType> OrganizationTypes { get; set; }
|
2023-06-25 18:36:02 +07:00
|
|
|
|
|
2023-06-26 14:02:04 +07:00
|
|
|
|
public DbSet<OrganizationLevel> OrganizationLevels { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<OrganizationOrganization> OrganizationOrganizations { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<OrganizationShortName> OrganizationShortNames { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<OrganizationStatus> OrganizationStatuses { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<OrganizationAgency> OrganizationAgencys { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<OrganizationGovernmentAgency> OrganizationGovernmentAgencys { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<OrganizationTelExternal> OrganizationTelExternals { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<OrganizationTelInternal> OrganizationTelInternals { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<OrganizationFax> OrganizationFaxs { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<RoyalHierarchy> RoyalHierarchys { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<RoyalType> RoyalTypes { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<Royal> Royals { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
2023-06-25 18:36:02 +07:00
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-06-26 14:02:04 +07:00
|
|
|
|
public ApplicationDBContext(DbContextOptions<ApplicationDBContext> options) : base(options)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Ignore Existing table from other service
|
|
|
|
|
|
//modelBuilder.Ignore<Prefix>();
|
|
|
|
|
|
//modelBuilder.Ignore<BloodGroup>();
|
|
|
|
|
|
//modelBuilder.Ignore<Gender>();
|
|
|
|
|
|
//modelBuilder.Ignore<PhysicalStatus>();
|
|
|
|
|
|
//modelBuilder.Ignore<Religion>();
|
|
|
|
|
|
//modelBuilder.Ignore<EducationLevel>();
|
|
|
|
|
|
//modelBuilder.Ignore<PositionPath>();
|
|
|
|
|
|
//modelBuilder.Ignore<PositionType>();
|
|
|
|
|
|
//modelBuilder.Ignore<PositionEmployeePosition>();
|
|
|
|
|
|
//modelBuilder.Ignore<PositionEmployeePositionSide>();
|
|
|
|
|
|
//modelBuilder.Ignore<PositionEmployeeGroup>();
|
|
|
|
|
|
//modelBuilder.Ignore<PositionEmployeeLine>();
|
|
|
|
|
|
//modelBuilder.Ignore<PositionEmployeeLevel>();
|
|
|
|
|
|
//modelBuilder.Ignore<PositionEmployeeStatus>();
|
|
|
|
|
|
//modelBuilder.Ignore<PositionLine>();
|
|
|
|
|
|
//modelBuilder.Ignore<PositionExecutive>();
|
|
|
|
|
|
//modelBuilder.Ignore<PositionStatus>();
|
|
|
|
|
|
//modelBuilder.Ignore<PositionLevel>();
|
|
|
|
|
|
//modelBuilder.Ignore<Relationship>();
|
|
|
|
|
|
//modelBuilder.Ignore<Position>();
|
|
|
|
|
|
//modelBuilder.Ignore<PositionPathSide>();
|
|
|
|
|
|
//modelBuilder.Ignore<PositionExecutiveSide>();
|
|
|
|
|
|
//modelBuilder.Ignore<InsigniaType>();
|
|
|
|
|
|
//modelBuilder.Ignore<Insignia>();
|
|
|
|
|
|
//modelBuilder.Ignore<Province>();
|
|
|
|
|
|
//modelBuilder.Ignore<District>();
|
|
|
|
|
|
//modelBuilder.Ignore<SubDistrict>();
|
|
|
|
|
|
//modelBuilder.Ignore<Holiday>();
|
|
|
|
|
|
//modelBuilder.Ignore<OrganizationType>();
|
|
|
|
|
|
//modelBuilder.Ignore<OrganizationLevel>();
|
|
|
|
|
|
//modelBuilder.Ignore<OrganizationOrganization>();
|
|
|
|
|
|
//modelBuilder.Ignore<OrganizationShortName>();
|
|
|
|
|
|
//modelBuilder.Ignore<OrganizationStatus>();
|
|
|
|
|
|
//modelBuilder.Ignore<OrganizationAgency>();
|
|
|
|
|
|
//modelBuilder.Ignore<OrganizationGovernmentAgency>();
|
|
|
|
|
|
//modelBuilder.Ignore<OrganizationTelExternal>();
|
|
|
|
|
|
//modelBuilder.Ignore<OrganizationTelInternal>();
|
|
|
|
|
|
//modelBuilder.Ignore<OrganizationFax>();
|
|
|
|
|
|
//modelBuilder.Ignore<RoyalHierarchy>();
|
|
|
|
|
|
//modelBuilder.Ignore<RoyalType>();
|
|
|
|
|
|
//modelBuilder.Ignore<Royal>();
|
|
|
|
|
|
|
|
|
|
|
|
base.OnModelCreating(modelBuilder);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override DbSet<TEntity> Set<TEntity>() where TEntity : class
|
|
|
|
|
|
{
|
|
|
|
|
|
return base.Set<TEntity>();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-06-25 18:36:02 +07:00
|
|
|
|
public Task<int> SaveChangesAsync()
|
2023-06-26 10:15:50 +07:00
|
|
|
|
{
|
|
|
|
|
|
return base.SaveChangesAsync();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-06-05 20:22:51 +07:00
|
|
|
|
}
|