Browse Source
Add `EnableRazorRuntimeCompilationOnDevelopment`
pull/10947/head
maliming
5 years ago
No known key found for this signature in database
GPG Key ID: 96224957E51C89E
3 changed files with
10 additions and
1 deletions
-
framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/Extensions/DependencyInjection/AbpMvcBuilderExtensions.cs
-
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
-
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs
|
|
|
@ -32,7 +32,7 @@ namespace Microsoft.Extensions.DependencyInjection |
|
|
|
applicationParts.Add(new AssemblyPart(assembly)); |
|
|
|
} |
|
|
|
|
|
|
|
public static void AddAbpRazorRuntimeCompilation(this IMvcBuilder mvcCoreBuilder) |
|
|
|
public static void AddAbpRazorRuntimeCompilation(this IMvcCoreBuilder mvcCoreBuilder) |
|
|
|
{ |
|
|
|
mvcCoreBuilder.AddRazorRuntimeCompilation(); |
|
|
|
mvcCoreBuilder.Services.Configure<MvcRazorRuntimeCompilationOptions>(options => |
|
|
|
|
|
|
|
@ -138,6 +138,12 @@ namespace Volo.Abp.AspNetCore.Mvc |
|
|
|
}) |
|
|
|
.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.AddAbpHybridJson(); |
|
|
|
|
|
|
|
context.Services.ExecutePreConfiguredActions(mvcBuilder); |
|
|
|
|
|
|
|
@ -14,11 +14,14 @@ namespace Volo.Abp.AspNetCore.Mvc |
|
|
|
|
|
|
|
public bool AutoModelValidation { get; set; } |
|
|
|
|
|
|
|
public bool EnableRazorRuntimeCompilationOnDevelopment { get; set; } |
|
|
|
|
|
|
|
public AbpAspNetCoreMvcOptions() |
|
|
|
{ |
|
|
|
ConventionalControllers = new AbpConventionalControllerOptions(); |
|
|
|
IgnoredControllersOnModelExclusion = new HashSet<Type>(); |
|
|
|
AutoModelValidation = true; |
|
|
|
EnableRazorRuntimeCompilationOnDevelopment = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|