Browse Source

Add `EnableRazorRuntimeCompilationOnDevelopment`

pull/10947/head
maliming 5 years ago
parent
commit
1960d5acfe
No known key found for this signature in database GPG Key ID: 96224957E51C89E
  1. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/Extensions/DependencyInjection/AbpMvcBuilderExtensions.cs
  2. 6
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
  3. 3
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs

2
framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/Extensions/DependencyInjection/AbpMvcBuilderExtensions.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 =>

6
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs

@ -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);

3
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs

@ -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;
}
}
}

Loading…
Cancel
Save