diff --git a/MobileConfiguration/MobileConfiguration.csproj b/MobileConfiguration/MobileConfiguration.csproj index 1e1b2dc..a4335bb 100644 --- a/MobileConfiguration/MobileConfiguration.csproj +++ b/MobileConfiguration/MobileConfiguration.csproj @@ -16,8 +16,9 @@ - - + + + diff --git a/MobileConfiguration/Program.cs b/MobileConfiguration/Program.cs index 3e99e44..af4029d 100644 --- a/MobileConfiguration/Program.cs +++ b/MobileConfiguration/Program.cs @@ -13,6 +13,7 @@ using Shared.Middleware; using Shared.Repositories; using System.Reflection; +using Shared.Logger.TennantContext; using ILogger = Microsoft.Extensions.Logging.ILogger; IConfigurationRoot configuration = new ConfigurationBuilder() @@ -32,10 +33,12 @@ .AddEnvironmentVariables(); // Add services to the container. +builder.Services.AddHttpContextAccessor(); builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); +builder.Services.AddScoped(); builder.Services.AddSingleton(); builder.Services.AddSingleton(typeof(IDbContextResolver<>), typeof(DbContextResolver<>)); Boolean isInMemoryDatabase = Boolean.Parse(ConfigurationReader.GetValue("AppSettings", "InMemoryDatabase")); @@ -61,6 +64,8 @@ String nlogConfigFilename = "nlog.config"; +app.UseMiddleware(); + if (app.Environment.IsDevelopment()) { var developmentNlogConfigFilename = "nlog.development.config"; @@ -85,7 +90,7 @@ // Configure the HTTP request pipeline. app.UseAuthorization(); -app.UseMiddleware(); + app.AddRequestLogging(); app.AddResponseLogging(); app.AddExceptionHandler();