|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
using Microsoft.AspNetCore.RequestLocalization;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
|
using Volo.Abp;
|
|
|
|
|
using Volo.Abp.AspNetCore.Auditing;
|
|
|
|
|
using Volo.Abp.AspNetCore.ExceptionHandling;
|
|
|
|
@ -19,8 +20,21 @@ namespace Microsoft.AspNetCore.Builder
|
|
|
|
|
{
|
|
|
|
|
Check.NotNull(app, nameof(app));
|
|
|
|
|
|
|
|
|
|
var application = app.ApplicationServices.GetRequiredService<IAbpApplicationWithExternalServiceProvider>();
|
|
|
|
|
var applicationLifetime = app.ApplicationServices.GetRequiredService<IHostApplicationLifetime>();
|
|
|
|
|
|
|
|
|
|
applicationLifetime.ApplicationStopping.Register(() =>
|
|
|
|
|
{
|
|
|
|
|
application.Shutdown();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
applicationLifetime.ApplicationStopped.Register(() =>
|
|
|
|
|
{
|
|
|
|
|
application.Dispose();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
app.ApplicationServices.GetRequiredService<ObjectAccessor<IApplicationBuilder>>().Value = app;
|
|
|
|
|
app.ApplicationServices.GetRequiredService<IAbpApplicationWithExternalServiceProvider>().Initialize(app.ApplicationServices);
|
|
|
|
|
application.Initialize(app.ApplicationServices);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static IApplicationBuilder UseAuditing(this IApplicationBuilder app)
|
|
|
|
@ -42,7 +56,8 @@ namespace Microsoft.AspNetCore.Builder
|
|
|
|
|
.UseMiddleware<AbpCorrelationIdMiddleware>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static IApplicationBuilder UseAbpRequestLocalization(this IApplicationBuilder app, Action<RequestLocalizationOptions> optionsAction = null)
|
|
|
|
|
public static IApplicationBuilder UseAbpRequestLocalization(this IApplicationBuilder app,
|
|
|
|
|
Action<RequestLocalizationOptions> optionsAction = null)
|
|
|
|
|
{
|
|
|
|
|
app.ApplicationServices
|
|
|
|
|
.GetRequiredService<IAbpRequestLocalizationOptionsProvider>()
|
|
|
|
@ -62,4 +77,4 @@ namespace Microsoft.AspNetCore.Builder
|
|
|
|
|
return app.UseMiddleware<AbpExceptionHandlingMiddleware>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|