C# Class Xipton.Razor.RazorMachine

The main razor template executer. Use a singleton instance because each instance creates its own type cache (at the template factory).
Inheritance: IDisposable, IRazorMachine
Mostra file Open project: jlamfers/RazorMachine Class Usage Examples

Public Methods

Method Description
ClearTypeCache ( ) : RazorMachine
Dispose ( ) : void
Execute ( string templateVirtualPathOrContent, object model = null, object viewbag = null, bool skipLayout = false, bool throwExceptionOnVirtualPathNotFound = true ) : ITemplate

Hybrid convenience executer. It decides whether to execute content or an url.

ExecuteContent ( string templateContent, object model = null, object viewbag = null, bool skipLayout = false ) : ITemplate

Renders the specified template content's result with the passed model instance and returns the template's rendered result. A corresponding virtual path is generated internally for being able to keep the compiled template type cached.

ExecuteUrl ( string templateVirtualPath, object model = null, object viewbag = null, bool skipLayout = false, bool throwExceptionOnVirtualPathNotFound = true ) : ITemplate

Executes the template by its virtual path and returns the resulting executed template instance.

GetRegisteredInMemoryTemplates ( ) : string>.IDictionary
RazorMachine ( ) : System
RazorMachine ( Xipton.Razor.Config.RazorConfig config ) : System
RazorMachine ( Type baseType = null, string rootOperatorPath = null, RazorCodeLanguage language = null, string defaultExtension = null, string autoIncludeNameWithoutExtension = null, string sharedLocation = null, bool includeGeneratedSourceCode = null, bool htmlEncode = null, IEnumerable references = null, IEnumerable namespaces = null, IEnumerable contentProviders = null, bool replaceReferences = false, bool replaceNamespaces = false, bool replaceContentProviders = false ) : System
RazorMachine ( string xmlContentOrFileName ) : System
RegisterTemplate ( string virtualPath, string content ) : RazorMachine
RemoveTemplate ( string virtualPath ) : RazorMachine

Protected Methods

Method Description
Dispose ( bool disposing ) : void
NormalizeVirtualPath ( string virtualPath ) : string

Method Details

ClearTypeCache() public method

public ClearTypeCache ( ) : RazorMachine
return RazorMachine

Dispose() public method

public Dispose ( ) : void
return void

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

Execute() public method

Hybrid convenience executer. It decides whether to execute content or an url.
public Execute ( string templateVirtualPathOrContent, object model = null, object viewbag = null, bool skipLayout = false, bool throwExceptionOnVirtualPathNotFound = true ) : ITemplate
templateVirtualPathOrContent string Content of the template URL or.
model object The model.
viewbag object The viewbag.
skipLayout bool if set to true [skip layout].
throwExceptionOnVirtualPathNotFound bool if set to true [throw exception on virtual path not found].
return ITemplate

ExecuteContent() public method

Renders the specified template content's result with the passed model instance and returns the template's rendered result. A corresponding virtual path is generated internally for being able to keep the compiled template type cached.
public ExecuteContent ( string templateContent, object model = null, object viewbag = null, bool skipLayout = false ) : ITemplate
templateContent string Content of the template.
model object The model
viewbag object The optional viewbag
skipLayout bool if set to true then any layout setting (probably at _ViewStart) is ignored.
return ITemplate

ExecuteUrl() public method

Executes the template by its virtual path and returns the resulting executed template instance.
public ExecuteUrl ( string templateVirtualPath, object model = null, object viewbag = null, bool skipLayout = false, bool throwExceptionOnVirtualPathNotFound = true ) : ITemplate
templateVirtualPath string The requested virtual path for the template.
model object The optional model.
viewbag object The optional viewbag.
skipLayout bool if set true then any layout setting is ignored
throwExceptionOnVirtualPathNotFound bool /// Optional. If set to true an exception is thrown if the requested path could not be resolved. /// If set to false then null is returned if the requested path could not be resolved. ///
return ITemplate

GetRegisteredInMemoryTemplates() public method

public GetRegisteredInMemoryTemplates ( ) : string>.IDictionary
return string>.IDictionary

NormalizeVirtualPath() protected method

protected NormalizeVirtualPath ( string virtualPath ) : string
virtualPath string
return string

RazorMachine() public method

public RazorMachine ( ) : System
return System

RazorMachine() public method

public RazorMachine ( Xipton.Razor.Config.RazorConfig config ) : System
config Xipton.Razor.Config.RazorConfig
return System

RazorMachine() public method

public RazorMachine ( Type baseType = null, string rootOperatorPath = null, RazorCodeLanguage language = null, string defaultExtension = null, string autoIncludeNameWithoutExtension = null, string sharedLocation = null, bool includeGeneratedSourceCode = null, bool htmlEncode = null, IEnumerable references = null, IEnumerable namespaces = null, IEnumerable contentProviders = null, bool replaceReferences = false, bool replaceNamespaces = false, bool replaceContentProviders = false ) : System
baseType System.Type
rootOperatorPath string
language System.Web.Razor.RazorCodeLanguage
defaultExtension string
autoIncludeNameWithoutExtension string
sharedLocation string
includeGeneratedSourceCode bool
htmlEncode bool
references IEnumerable
namespaces IEnumerable
contentProviders IEnumerable
replaceReferences bool
replaceNamespaces bool
replaceContentProviders bool
return System

RazorMachine() public method

public RazorMachine ( string xmlContentOrFileName ) : System
xmlContentOrFileName string
return System

RegisterTemplate() public method

public RegisterTemplate ( string virtualPath, string content ) : RazorMachine
virtualPath string
content string
return RazorMachine

RemoveTemplate() public method

public RemoveTemplate ( string virtualPath ) : RazorMachine
virtualPath string
return RazorMachine