fix : Optimize Query

This commit is contained in:
Suphonchai Phoonsawat 2024-07-07 09:59:37 +07:00
parent 89ef146c19
commit a911648907
9 changed files with 168 additions and 232 deletions

View file

@ -12,9 +12,7 @@ namespace BMA.EHR.Infrastructure
{
public static IServiceCollection AddMessageQueue(this IServiceCollection services)
{
services.AddTransient<RabbitMQConnection>();
services.AddTransient<RabbitMQProducer>();
services.AddTransient<RabbitMQConsumer>();
services.AddHostedService<RabbitMQConsumer>();
return services;
}
@ -37,7 +35,7 @@ namespace BMA.EHR.Infrastructure
}),
ServiceLifetime.Transient);
services.AddScoped<ILeaveDbContext>(provider => provider.GetService<LeaveDbContext>());
services.AddTransient<ILeaveDbContext>(provider => provider.GetService<LeaveDbContext>());
return services;
}
@ -60,7 +58,7 @@ namespace BMA.EHR.Infrastructure
}),
ServiceLifetime.Transient);
services.AddScoped<IDisciplineDbContext>(provider => provider.GetService<DisciplineDbContext>());
services.AddTransient<IDisciplineDbContext>(provider => provider.GetService<DisciplineDbContext>());
return services;
}
@ -83,7 +81,7 @@ namespace BMA.EHR.Infrastructure
}),
ServiceLifetime.Transient);
services.AddScoped<IApplicationDBContext>(provider => provider.GetService<ApplicationDBContext>());
services.AddTransient<IApplicationDBContext>(provider => provider.GetService<ApplicationDBContext>());
var connectionStringExam = configuration.GetConnectionString("ExamConnection");
@ -97,7 +95,8 @@ namespace BMA.EHR.Infrastructure
}),
ServiceLifetime.Transient);
services.AddScoped<IApplicationDBExamContext>(provider => provider.GetService<ApplicationDBExamContext>());
services.AddTransient<IApplicationDBExamContext>(provider => provider.GetService<ApplicationDBExamContext>());
return services;
}