RazorCompilationService Class

Default implementation of Microsoft.AspNetCore.Mvc.Razor.Compilation.IRazorCompilationService.

Namespace
Microsoft.AspNetCore.Mvc.Razor.Internal
Assemblies
  • Microsoft.AspNetCore.Mvc.Razor

Syntax

public class RazorCompilationService : IRazorCompilationService
class Microsoft.AspNetCore.Mvc.Razor.Internal.RazorCompilationService

Constructors

RazorCompilationService(Microsoft.AspNetCore.Mvc.Razor.Compilation.ICompilationService, Microsoft.AspNetCore.Mvc.Razor.IMvcRazorHost, Microsoft.AspNetCore.Mvc.Razor.Internal.IRazorViewEngineFileProviderAccessor, Microsoft.Extensions.Logging.ILoggerFactory)

Instantiates a new instance of the Microsoft.AspNetCore.Mvc.Razor.Internal.RazorCompilationService class.

Arguments:
public RazorCompilationService(ICompilationService compilationService, IMvcRazorHost razorHost, IRazorViewEngineFileProviderAccessor fileProviderAccessor, ILoggerFactory loggerFactory)

Methods

Compile(Microsoft.AspNetCore.Mvc.Razor.Compilation.RelativeFileInfo)
Return type:Microsoft.AspNetCore.Mvc.Razor.Compilation.CompilationResult
public CompilationResult Compile(RelativeFileInfo file)
GenerateCode(System.String, System.IO.Stream)

Generate code for the Razor file at <em>relativePath</em> with content <em>inputStream</em>.

Arguments:
  • relativePath (System.String) – The path of the Razor file relative to the root of the application. Used to generate line pragmas and calculate the class name of the generated type.
  • inputStream (System.IO.Stream) – A System.IO.Stream that contains the Razor content.
Return type:

Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults

Returns:

A Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults instance containing results of code generation.

protected virtual GeneratorResults GenerateCode(string relativePath, Stream inputStream)