Browse Source
Merge pull request #20630 from abpframework/auto-merge/rel-8-3/2938
Merge branch dev with rel-8.3
pull/20638/head
maliming
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
23 additions and
7 deletions
-
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/AbpAspNetCoreMvcUiBundlingModule.cs
-
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/AbpMvcLibsService.cs
-
framework/src/Volo.Abp.AspNetCore/Volo/Abp/ApplicationInitializationContextExtensions.cs
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
using Volo.Abp.AspNetCore.Mvc.Libs; |
|
|
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; |
|
|
|
using Volo.Abp.Data; |
|
|
|
using Volo.Abp.Minify; |
|
|
|
using Volo.Abp.Modularity; |
|
|
|
|
|
|
|
@ -14,9 +15,12 @@ public class AbpAspNetCoreMvcUiBundlingModule : AbpModule |
|
|
|
{ |
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
Configure<AbpMvcLibsOptions>(options => |
|
|
|
if (!context.Services.IsDataMigrationEnvironment()) |
|
|
|
{ |
|
|
|
options.CheckLibs = true; |
|
|
|
}); |
|
|
|
Configure<AbpMvcLibsOptions>(options => |
|
|
|
{ |
|
|
|
options.CheckLibs = true; |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -1,5 +1,4 @@ |
|
|
|
using System; |
|
|
|
using System.IO; |
|
|
|
using System.Linq; |
|
|
|
using System.Net; |
|
|
|
using System.Text; |
|
|
|
@ -7,7 +6,6 @@ using System.Threading.Tasks; |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
using Microsoft.AspNetCore.Hosting; |
|
|
|
using Microsoft.AspNetCore.Http; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using Microsoft.Extensions.Options; |
|
|
|
@ -25,7 +23,14 @@ public class AbpMvcLibsService : IAbpMvcLibsService, ITransientDependency |
|
|
|
var options = context.ServiceProvider.GetRequiredService<IOptions<AbpMvcLibsOptions>>().Value; |
|
|
|
if (options.CheckLibs) |
|
|
|
{ |
|
|
|
var app = context.GetApplicationBuilder(); |
|
|
|
var app = context.GetApplicationBuilderOrNull(); |
|
|
|
if (app == null) |
|
|
|
{ |
|
|
|
var logger = context.ServiceProvider.GetRequiredService<ILogger<AbpMvcLibsService>>(); |
|
|
|
logger.LogWarning($"The {nameof(IApplicationBuilder)} is not available. The 'CheckLibs' feature is disabled!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
app.Use(async (httpContext, next) => |
|
|
|
{ |
|
|
|
if (!await CheckLibsAsyncOnceAsync(httpContext)) |
|
|
|
|
|
|
|
@ -12,7 +12,14 @@ public static class ApplicationInitializationContextExtensions |
|
|
|
{ |
|
|
|
public static IApplicationBuilder GetApplicationBuilder(this ApplicationInitializationContext context) |
|
|
|
{ |
|
|
|
return context.ServiceProvider.GetRequiredService<IObjectAccessor<IApplicationBuilder>>().Value!; |
|
|
|
var applicationBuilder = context.ServiceProvider.GetRequiredService<IObjectAccessor<IApplicationBuilder>>().Value; |
|
|
|
Check.NotNull(applicationBuilder, nameof(applicationBuilder)); |
|
|
|
return applicationBuilder; |
|
|
|
} |
|
|
|
|
|
|
|
public static IApplicationBuilder? GetApplicationBuilderOrNull(this ApplicationInitializationContext context) |
|
|
|
{ |
|
|
|
return context.ServiceProvider.GetRequiredService<IObjectAccessor<IApplicationBuilder>>().Value; |
|
|
|
} |
|
|
|
|
|
|
|
public static IWebHostEnvironment GetEnvironment(this ApplicationInitializationContext context) |
|
|
|
|