maliming
5 months ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
4 changed files with
1 additions and
30 deletions
-
framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/Extensions/DependencyInjection/AbpMvcBuilderExtensions.cs
-
framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj
-
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
-
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs
|
|
|
@ -1,11 +1,7 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Reflection; |
|
|
|
using Microsoft.AspNetCore.Mvc.ApplicationParts; |
|
|
|
using Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation; |
|
|
|
using Volo.Abp.AspNetCore.VirtualFileSystem; |
|
|
|
using Volo.Abp.DependencyInjection; |
|
|
|
|
|
|
|
namespace Microsoft.Extensions.DependencyInjection; |
|
|
|
|
|
|
|
@ -31,17 +27,4 @@ public static class AbpMvcBuilderExtensions |
|
|
|
|
|
|
|
applicationParts.Add(new AssemblyPart(assembly)); |
|
|
|
} |
|
|
|
|
|
|
|
public static void AddAbpRazorRuntimeCompilation(this IMvcCoreBuilder mvcCoreBuilder) |
|
|
|
{ |
|
|
|
mvcCoreBuilder.AddRazorRuntimeCompilation(); |
|
|
|
mvcCoreBuilder.Services.Configure<MvcRazorRuntimeCompilationOptions>(options => |
|
|
|
{ |
|
|
|
options.FileProviders.Add( |
|
|
|
new RazorViewEngineVirtualFileProvider( |
|
|
|
mvcCoreBuilder.Services.GetSingletonInstance<IObjectAccessor<IServiceProvider>>() |
|
|
|
) |
|
|
|
); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -30,7 +30,6 @@ |
|
|
|
</ItemGroup> |
|
|
|
|
|
|
|
<ItemGroup> |
|
|
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" /> |
|
|
|
<PackageReference Include="Asp.Versioning.Mvc" /> |
|
|
|
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" /> |
|
|
|
</ItemGroup> |
|
|
|
|
|
|
|
@ -139,20 +139,12 @@ public class AbpAspNetCoreMvcModule : AbpModule |
|
|
|
}) |
|
|
|
.AddViewLocalization(); //TODO: How to configure from the application? Also, consider to move to a UI module since APIs does not care about it.
|
|
|
|
|
|
|
|
if (context.Services.GetHostingEnvironment().IsDevelopment() && |
|
|
|
context.Services.ExecutePreConfiguredActions<AbpAspNetCoreMvcOptions>().EnableRazorRuntimeCompilationOnDevelopment) |
|
|
|
{ |
|
|
|
mvcCoreBuilder.AddAbpRazorRuntimeCompilation(); |
|
|
|
} |
|
|
|
|
|
|
|
mvcCoreBuilder.AddAbpJson(); |
|
|
|
|
|
|
|
context.Services.ExecutePreConfiguredActions(mvcBuilder); |
|
|
|
|
|
|
|
//TODO: AddViewLocalization by default..?
|
|
|
|
|
|
|
|
context.Services.TryAddSingleton<IActionContextAccessor, ActionContextAccessor>(); |
|
|
|
|
|
|
|
//Use DI to create controllers
|
|
|
|
mvcBuilder.AddControllersAsServices(); |
|
|
|
|
|
|
|
|
|
|
|
@ -20,8 +20,6 @@ public class AbpAspNetCoreMvcOptions |
|
|
|
|
|
|
|
public bool AutoModelValidation { get; set; } |
|
|
|
|
|
|
|
public bool EnableRazorRuntimeCompilationOnDevelopment { get; set; } |
|
|
|
|
|
|
|
public bool ChangeControllerModelApiExplorerGroupName { get; set; } |
|
|
|
|
|
|
|
public AbpAspNetCoreMvcOptions() |
|
|
|
@ -30,7 +28,6 @@ public class AbpAspNetCoreMvcOptions |
|
|
|
IgnoredControllersOnModelExclusion = new HashSet<Type>(); |
|
|
|
ControllersToRemove = new HashSet<Type>(); |
|
|
|
AutoModelValidation = true; |
|
|
|
EnableRazorRuntimeCompilationOnDevelopment = true; |
|
|
|
ChangeControllerModelApiExplorerGroupName = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|