Reacting to Mvc changes
This commit is contained in:
parent
7d7ecf3a1b
commit
9231dbda4f
|
|
@ -37,14 +37,19 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
||||||
var mvcBuilderConfiguration = GetConfigureCompilationAction(configureCompilationType);
|
var mvcBuilderConfiguration = GetConfigureCompilationAction(configureCompilationType);
|
||||||
var serviceProvider = GetProvider(mvcBuilderConfiguration);
|
var serviceProvider = GetProvider(mvcBuilderConfiguration);
|
||||||
|
|
||||||
CompilationService = (RazorCompilationService)serviceProvider.GetRequiredService<IRazorCompilationService>();
|
|
||||||
Engine = serviceProvider.GetRequiredService<RazorEngine>();
|
Engine = serviceProvider.GetRequiredService<RazorEngine>();
|
||||||
|
TemplateEngine = new MvcRazorTemplateEngine(Engine, serviceProvider.GetRequiredService<RazorProject>())
|
||||||
|
{
|
||||||
|
Options =
|
||||||
|
{
|
||||||
|
ImportsFileName = "_ViewImports.cshtml",
|
||||||
|
}
|
||||||
|
};
|
||||||
Compiler = serviceProvider.GetRequiredService<CSharpCompiler>();
|
Compiler = serviceProvider.GetRequiredService<CSharpCompiler>();
|
||||||
ViewEngineOptions = serviceProvider.GetRequiredService<IOptions<RazorViewEngineOptions>>().Value;
|
ViewEngineOptions = serviceProvider.GetRequiredService<IOptions<RazorViewEngineOptions>>().Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MvcRazorTemplateEngine TemplateEngine { get; }
|
||||||
public RazorCompilationService CompilationService { get; }
|
|
||||||
|
|
||||||
public RazorEngine Engine { get; }
|
public RazorEngine Engine { get; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -238,9 +238,8 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
||||||
var fileInfo = files[i];
|
var fileInfo = files[i];
|
||||||
using (var fileStream = fileInfo.CreateReadStream())
|
using (var fileStream = fileInfo.CreateReadStream())
|
||||||
{
|
{
|
||||||
var codeDocument = MvcServiceProvider.CompilationService.CreateCodeDocument(fileInfo.ViewEnginePath, fileStream);
|
var csharpDocument = MvcServiceProvider.TemplateEngine.GenerateCode(fileInfo.ViewEnginePath);
|
||||||
var result = MvcServiceProvider.CompilationService.ProcessCodeDocument(codeDocument);
|
results[i] = new ViewCompilationInfo(fileInfo, csharpDocument);
|
||||||
results[i] = new ViewCompilationInfo(fileInfo, result);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue