fix : Optimize Query
This commit is contained in:
parent
89ef146c19
commit
a911648907
9 changed files with 168 additions and 232 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application;
|
||||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.Reports;
|
||||
using BMA.EHR.Domain.Middlewares;
|
||||
using BMA.EHR.Infrastructure;
|
||||
|
|
@ -91,8 +92,7 @@ var builder = WebApplication.CreateBuilder(args);
|
|||
builder.Services.AddLeaveApplication();
|
||||
builder.Services.AddLeavePersistence(builder.Configuration);
|
||||
|
||||
// RabbitMQ
|
||||
builder.Services.AddMessageQueue();
|
||||
|
||||
|
||||
builder.Services.AddControllers(options =>
|
||||
{
|
||||
|
|
@ -106,7 +106,7 @@ var builder = WebApplication.CreateBuilder(args);
|
|||
// Register DbContext
|
||||
var defaultConnection = builder.Configuration.GetConnectionString("DefaultConnection");
|
||||
builder.Services.AddDbContext<ApplicationDBContext>(options =>
|
||||
options.UseMySql(defaultConnection, ServerVersion.AutoDetect(defaultConnection)));
|
||||
options.UseMySql(defaultConnection, ServerVersion.AutoDetect(defaultConnection)), ServiceLifetime.Transient);
|
||||
builder.Services.AddHealthChecks();
|
||||
// Add Hangfire services.
|
||||
builder.Services.AddHangfire(configuration => configuration
|
||||
|
|
@ -129,6 +129,19 @@ var builder = WebApplication.CreateBuilder(args);
|
|||
TablesPrefix = "Hangfire"
|
||||
})));
|
||||
builder.Services.AddHangfireServer();
|
||||
|
||||
|
||||
// RabbitMQ
|
||||
//builder.Services.AddTransient<RabbitMQConsumer>(provider =>
|
||||
//{
|
||||
// var serviceScopeFactory = provider.GetRequiredService<IServiceScopeFactory>();
|
||||
// var userRepo = provider.GetRequiredService<UserProfileRepository>();
|
||||
// var insigniaRepo = provider.GetRequiredService<InsigniaPeriodsRepository>();
|
||||
// var httpContext = provider.GetRequiredService<IHttpContextAccessor>();
|
||||
// var config = provider.GetRequiredService<IConfiguration>();
|
||||
|
||||
// return new RabbitMQConsumer(userRepo, insigniaRepo, httpContext, serviceScopeFactory, config);
|
||||
//});
|
||||
}
|
||||
|
||||
var app = builder.Build();
|
||||
|
|
@ -151,6 +164,8 @@ var app = builder.Build();
|
|||
app.MapHealthChecks("/health");
|
||||
|
||||
|
||||
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseCors();
|
||||
app.UseAuthentication();
|
||||
|
|
@ -176,8 +191,8 @@ var app = builder.Build();
|
|||
await using var db = scope.ServiceProvider.GetRequiredService<ApplicationDBContext>();
|
||||
await db.Database.MigrateAsync();
|
||||
|
||||
var rabbitMQConsumer = app.Services.GetRequiredService<RabbitMQConsumer>();
|
||||
rabbitMQConsumer.StartReceiving();
|
||||
//var rabbitMQConsumer = app.Services.GetRequiredService<RabbitMQConsumer>();
|
||||
//rabbitMQConsumer.StartReceiving();
|
||||
|
||||
app.Run();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue