Reacting to Mvc changes

This commit is contained in:
Pranav K 2017-03-13 18:18:03 -07:00
parent 7d7ecf3a1b
commit 9231dbda4f
2 changed files with 10 additions and 6 deletions

View File

@ -37,14 +37,19 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
var mvcBuilderConfiguration = GetConfigureCompilationAction(configureCompilationType);
var serviceProvider = GetProvider(mvcBuilderConfiguration);
CompilationService = (RazorCompilationService)serviceProvider.GetRequiredService<IRazorCompilationService>();
Engine = serviceProvider.GetRequiredService<RazorEngine>();
TemplateEngine = new MvcRazorTemplateEngine(Engine, serviceProvider.GetRequiredService<RazorProject>())
{
Options =
{
ImportsFileName = "_ViewImports.cshtml",
}
};
Compiler = serviceProvider.GetRequiredService<CSharpCompiler>();
ViewEngineOptions = serviceProvider.GetRequiredService<IOptions<RazorViewEngineOptions>>().Value;
}
public RazorCompilationService CompilationService { get; }
public MvcRazorTemplateEngine TemplateEngine { get; }
public RazorEngine Engine { get; }

View File

@ -238,9 +238,8 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
var fileInfo = files[i];
using (var fileStream = fileInfo.CreateReadStream())
{
var codeDocument = MvcServiceProvider.CompilationService.CreateCodeDocument(fileInfo.ViewEnginePath, fileStream);
var result = MvcServiceProvider.CompilationService.ProcessCodeDocument(codeDocument);
results[i] = new ViewCompilationInfo(fileInfo, result);
var csharpDocument = MvcServiceProvider.TemplateEngine.GenerateCode(fileInfo.ViewEnginePath);
results[i] = new ViewCompilationInfo(fileInfo, csharpDocument);
}
});