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: - compilationService (Microsoft.AspNetCore.Mvc.Razor.Compilation.ICompilationService) – The
Microsoft.AspNetCore.Mvc.Razor.Compilation.ICompilationService
to compile generated code. - razorHost (Microsoft.AspNetCore.Mvc.Razor.IMvcRazorHost) – The
Microsoft.AspNetCore.Mvc.Razor.IMvcRazorHost
to generate code from Razor files. - fileProviderAccessor (Microsoft.AspNetCore.Mvc.Razor.Internal.IRazorViewEngineFileProviderAccessor) – The
Microsoft.AspNetCore.Mvc.Razor.Internal.IRazorViewEngineFileProviderAccessor
. - loggerFactory (Microsoft.Extensions.Logging.ILoggerFactory) – The
Microsoft.Extensions.Logging.ILoggerFactory
.
public RazorCompilationService(ICompilationService compilationService, IMvcRazorHost razorHost, IRazorViewEngineFileProviderAccessor fileProviderAccessor, ILoggerFactory loggerFactory)
- compilationService (Microsoft.AspNetCore.Mvc.Razor.Compilation.ICompilationService) – The
-
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: Returns: A
Microsoft.AspNetCore.Razor.CodeGenerators.GeneratorResults
instance containing results of code generation.protected virtual GeneratorResults GenerateCode(string relativePath, Stream inputStream)
-