diff --git a/Source/Shared/Features/EFCore/Registrator.cs b/Source/Shared/Features/EFCore/Registrator.cs index dceed3c9..2738fd64 100644 --- a/Source/Shared/Features/EFCore/Registrator.cs +++ b/Source/Shared/Features/EFCore/Registrator.cs @@ -3,7 +3,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Shared.Features.EFCore.Configuration; -using Shared.Features.Server.ExecutionContext; namespace Shared.Features.EFCore { @@ -20,7 +19,7 @@ public static IServiceCollection RegisterEFCore(this IServiceCollection services public static IApplicationBuilder UseEFCoreMiddleware(this IApplicationBuilder app) { - app.UseMiddleware(); + app.UseMiddleware(); return app; } diff --git a/Source/Shared/Features/Registrator.cs b/Source/Shared/Features/Registrator.cs index 565ecff5..d0ee5031 100644 --- a/Source/Shared/Features/Registrator.cs +++ b/Source/Shared/Features/Registrator.cs @@ -5,6 +5,7 @@ using Shared.Features.EFCore; using Shared.Features.EmailSender; using Shared.Features.Modules; +using Shared.Features.Server.ExecutionContext; namespace Shared.Features { @@ -20,12 +21,15 @@ public static IServiceCollection AddSharedFeatures(this IServiceCollection servi services.RegisterEFCore(configuration); services.RegisterEmailSender(configuration); + services.AddServerExecutionContext(); + return services; } public static IApplicationBuilder UseSharedFeaturesMiddleware(this IApplicationBuilder app) { app.UseEFCoreMiddleware(); + app.UseServerExecutionContextMiddleware(); return app; } diff --git a/Source/Shared/Features/Server/ExecutionContext/Registrator.cs b/Source/Shared/Features/Server/ExecutionContext/Registrator.cs index 77d60fc3..383c1a0c 100644 --- a/Source/Shared/Features/Server/ExecutionContext/Registrator.cs +++ b/Source/Shared/Features/Server/ExecutionContext/Registrator.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.DependencyInjection; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; using Shared.Kernel.BuildingBlocks; namespace Shared.Features.Server.ExecutionContext @@ -12,5 +13,12 @@ public static IServiceCollection AddServerExecutionContext(this IServiceCollecti services.AddScoped(ServerExecutionContext.CreateInstance); return services; } + + public static IApplicationBuilder UseServerExecutionContextMiddleware(this IApplicationBuilder app) + { + app.UseMiddleware(); + + return app; + } } } diff --git a/Source/Web/Server/Startup.cs b/Source/Web/Server/Startup.cs index 3bfbc20e..31652a63 100644 --- a/Source/Web/Server/Startup.cs +++ b/Source/Web/Server/Startup.cs @@ -34,7 +34,6 @@ public void ConfigureServices(IServiceCollection services) services.AddAuth(); - services.AddServerExecutionContext(); services.AddBuildingBlocks(); services.AddSharedFeatures(); @@ -67,8 +66,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseAuthentication(); app.UseAuthorization(); - app.UseSharedFeaturesMiddleware(); app.UseBuildingBlocksMiddleware(); + app.UseSharedFeaturesMiddleware(); app.UseModules(env);