RazorEngineHost Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Defines the environment in which a Razor template will live
public ref class RazorEngineHost
public class RazorEngineHost
type RazorEngineHost = class
Public Class RazorEngineHost
- Inheritance
-
RazorEngineHost
- Derived
Remarks
The host defines the following things: * What method names will be used for rendering markup, expressions etc. For example "Write", "WriteLiteral" * The namespace imports to be added to every page generated via this host * The default Base Class to inherit the generated class from * The default Class Name and Namespace for the generated class (can be overridden by parameters in RazorTemplateEngine.GeneratedCode) * The language of the code in a Razor page * The markup, code parsers and chunk generators to use (the system will select defaults, but a Host gets a change to augment them) ** See DecorateNNN methods * Additional code to add to the generated code (see PostProcessGeneratedCode)
Constructors
RazorEngineHost() | |
RazorEngineHost(RazorCodeLanguage, Func<ParserBase>) | |
RazorEngineHost(RazorCodeLanguage) |
Creates a host which uses the specified code language and the HTML markup language |
Properties
CodeLanguage |
The language of the code within the Razor template. |
DefaultBaseClass |
The base-class of the generated class |
DefaultClassName |
The name of the generated class |
DefaultNamespace |
The namespace which will contain the generated class |
DesignTimeMode |
Indicates if the parser and chunk generator should run in design-time mode |
EnableInstrumentation |
Boolean indicating if instrumentation code should be injected into the output page |
GeneratedClassContext |
Details about the methods and types that should be used to generate code for Razor constructs |
InstrumentedSourceFilePath |
Gets or sets the path to use for this document when generating Instrumentation calls |
IsIndentingWithTabs |
Gets or sets whether the design time editor is using tabs or spaces for indentation. |
NamespaceImports |
A list of namespaces to import in the generated file |
StaticHelpers |
Boolean indicating if helper methods should be instance methods or static methods |
TabSize |
Tab size used by the hosting editor, when indenting with tabs. |
TagHelperDescriptorResolver |
The ITagHelperDescriptorResolver used to resolve TagHelperDescriptors. |
Methods
CreateMarkupParser() |
Constructs the markup parser. Must return a new instance on EVERY call to ensure thread-safety |
DecorateChunkGenerator(RazorChunkGenerator) |
Gets an instance of the chunk generator and is provided an opportunity to decorate or replace it |
DecorateCodeGenerator(CodeGenerator, CodeGeneratorContext) |
Gets an instance of the code generator and is provided an opportunity to decorate or replace it |
DecorateCodeParser(ParserBase) |
Gets an instance of the code parser and is provided an opportunity to decorate or replace it |
DecorateMarkupParser(ParserBase) |
Gets an instance of the markup parser and is provided an opportunity to decorate or replace it |
DecorateRazorParser(RazorParser, String) |
Provides an opportunity for derived types to modify the instance of RazorParser used by the RazorTemplateEngine to parse the Razor tree. |