LV1_006 - เช็คเวลาต้องลงเวลาเข้าหรือออกงาน (USER)

This commit is contained in:
Suphonchai Phoonsawat 2023-11-10 14:40:53 +07:00
parent c9f68b045b
commit 065314fd6c
20 changed files with 967 additions and 258 deletions

View file

@ -9,6 +9,30 @@ namespace BMA.EHR.Infrastructure
{
public static class InfrastructureServiceRegistration
{
public static IServiceCollection AddLeavePersistence(this IServiceCollection services,
IConfiguration configuration)
{
services.AddScoped<IApplicationDBExamContext>(provider => provider.GetService<ApplicationDBExamContext>());
// leave db context
var connectionStringLeave = configuration.GetConnectionString("LeaveConnection");
services.AddDbContext<LeaveDbContext>(options =>
options.UseMySql(connectionStringLeave, ServerVersion.AutoDetect(connectionStringLeave),
b =>
{
b.MigrationsAssembly(typeof(LeaveDbContext).Assembly.FullName);
b.MigrationsHistoryTable("__LeaveMigrationsHistory");
}),
ServiceLifetime.Transient);
services.AddScoped<IApplicationDBContext>(provider => provider.GetService<LeaveDbContext>());
return services;
}
public static IServiceCollection AddPersistence(this IServiceCollection services,
IConfiguration configuration)
{
@ -41,22 +65,7 @@ namespace BMA.EHR.Infrastructure
}),
ServiceLifetime.Transient);
services.AddScoped<IApplicationDBExamContext>(provider => provider.GetService<ApplicationDBExamContext>());
// leave db context
var connectionStringLeave = configuration.GetConnectionString("LeaveConnection");
services.AddDbContext<LeaveDbContext>(options =>
options.UseMySql(connectionStringLeave, ServerVersion.AutoDetect(connectionStringLeave),
b =>
{
b.MigrationsAssembly(typeof(LeaveDbContext).Assembly.FullName);
b.MigrationsHistoryTable("__LeaveMigrationsHistory");
}),
ServiceLifetime.Transient);
services.AddScoped<IApplicationDBContext>(provider => provider.GetService<LeaveDbContext>());
return services;
}