RazorEngine


Razor

Defined in RazorEngine.dll.

Provides quick access to template functions.

Static members

Static memberDescription
Compile(razorTemplate, name)
Signature: (razorTemplate:string * name:string) -> unit

Compiles the specified template.

Compile(razorTemplate, modelType, name)
Signature: (razorTemplate:string * modelType:Type * name:string) -> unit

Compiles the specified template.

Compile(razorTemplate, name)
Signature: (razorTemplate:string * name:string) -> unit
Type parameters: 'T

Compiles the specified template.

CreateTemplate(razorTemplate)
Signature: razorTemplate:string -> ITemplate

Creates an instance of ITemplate from the specified string template.

Returns: An instance of .

CreateTemplate(razorTemplate, model)
Signature: (razorTemplate:string * model:'T) -> ITemplate
Type parameters: 'T

Creates an instance of ITemplate`1 from the specified string template.

Returns: An instance of .

CreateTemplates(...)
Signature: (razorTemplates:IEnumerable<string> * parallel:bool) -> IEnumerable<ITemplate>

Creates a set of templates from the specified string templates.

Returns: The enumerable set of template instances.

CreateTemplates(...)
Signature: (razorTemplates:IEnumerable<string> * models:IEnumerable<'T> * parallel:bool) -> IEnumerable<ITemplate>
Type parameters: 'T

Creates a set of templates from the specified string templates and models.

Returns: The enumerable set of template instances.

CreateTemplateType(razorTemplate)
Signature: razorTemplate:string -> Type

Creates a Type that can be used to instantiate an instance of a template.

Returns: An instance of .

CreateTemplateType(...)
Signature: (razorTemplate:string * modelType:Type) -> Type

Creates a Type that can be used to instantiate an instance of a template.

Returns: An instance of .

CreateTemplateTypes(...)
Signature: (razorTemplates:IEnumerable<string> * parallel:bool) -> IEnumerable<Type>

Crates a set of template types from the specfied string templates.

Returns: The set of instances.

CreateTemplateTypes(...)
Signature: (razorTemplates:IEnumerable<string> * modelType:Type * parallel:bool) -> IEnumerable<Type>

Creates a set of template types from the specfied string templates.

Returns: The set of instances.

GetTemplate(razorTemplate, name)
Signature: (razorTemplate:string * name:string) -> ITemplate

Gets an instance of the template using the cached compiled type, or compiles the template type if it does not exist in the cache.

Returns: An instance of .

GetTemplate(razorTemplate, model, name)
Signature: (razorTemplate:string * model:'T * name:string) -> ITemplate
Type parameters: 'T

Gets an instance of the template using the cached compiled type, or compiles the template type if it does not exist in the cache.

Returns: An instance of .

GetTemplates(...)
Signature: (razorTemplates:IEnumerable<string> * names:IEnumerable<string> * parallel:bool) -> IEnumerable<ITemplate>

Gets the set of template instances for the specified string templates. Cached templates will be considered and if they do not exist, new types will be created and instantiated.

Returns: The set of instances.

GetTemplates(...)
Signature: (razorTemplates:IEnumerable<string> * models:IEnumerable<'T> * names:IEnumerable<string> * parallel:bool) -> IEnumerable<ITemplate>
Type parameters: 'T

Gets the set of template instances for the specified string templates. Cached templates will be considered and if they do not exist, new types will be created and instantiated.

Returns: The set of instances.

Parse(razorTemplate)
Signature: razorTemplate:string -> string

Parses and returns the result of the specified string template.

Returns: The string result of the template.

Parse(razorTemplate, name)
Signature: (razorTemplate:string * name:string) -> string

Parses and returns the result of the specified string template. This method will provide a cache check to see if the compiled template type already exists and is valid.

Returns: The string result of the template.

Parse(razorTemplate, model)
Signature: (razorTemplate:string * model:obj) -> string

Parses and returns the result of the specified string template.

Returns: The string result of the template.

Parse(razorTemplate, model)
Signature: (razorTemplate:string * model:'T) -> string
Type parameters: 'T

Parses and returns the result of the specified string template.

Returns: The string result of the template.

Parse(razorTemplate, model, name)
Signature: (razorTemplate:string * model:'T * name:string) -> string
Type parameters: 'T

Parses and returns the result of the specified string template.

Returns: The string result of the template.

Parse(...)
Signature: (razorTemplate:string * model:'T * viewBag:DynamicViewBag * name:string) -> string
Type parameters: 'T

Backwards Compat

Returns:

Parse(razorTemplate, model, name)
Signature: (razorTemplate:string * model:obj * name:string) -> string

Parses and returns the result of the specified string template.

Returns: The string result of the template.

Parse(...)
Signature: (razorTemplate:string * model:obj * viewBag:DynamicViewBag * name:string) -> string

Backwards Compat

Returns:

ParseMany(razorTemplates, parallel)
Signature: (razorTemplates:IEnumerable<string> * parallel:bool) -> IEnumerable<string>

Parses the specified set of templates.

Returns: The set of parsed template results.

ParseMany(...)
Signature: (razorTemplates:IEnumerable<string> * cacheNames:IEnumerable<string> * parallel:bool) -> IEnumerable<string>

Parses the specified set of templates.

Returns: The set of parsed template results.

ParseMany(...)
Signature: (razorTemplate:string * models:IEnumerable<'T> * parallel:bool) -> IEnumerable<string>
Type parameters: 'T

Parses the template and merges with the many models provided.

Returns: The set of parsed template results.

ParseMany(...)
Signature: (razorTemplates:IEnumerable<string> * models:IEnumerable<'T> * parallel:bool) -> IEnumerable<string>
Type parameters: 'T

Parses the specified set of templates.

Returns: The set of parsed template results.

ParseMany(...)
Signature: (razorTemplates:IEnumerable<string> * models:IEnumerable<'T> * names:IEnumerable<string> * parallel:bool) -> IEnumerable<string>
Type parameters: 'T

Parses the specified set of templates.

Returns: The set of parsed template results.

Resolve(name)
Signature: name:string -> ITemplate

Resolves the template with the specified name.

Returns: The resolved template.

Resolve(name, model)
Signature: (name:string * model:obj) -> ITemplate

Resolves the template with the specified name.

Returns: The resolved template.

Resolve(name, model)
Signature: (name:string * model:'T) -> ITemplate
Type parameters: 'T

Resolves the template with the specified name.

Returns: The resolved template.

Run(name)
Signature: name:string -> string

Runs the template with the specified name.

Returns: The string result of the template.

Run(name, model)
Signature: (name:string * model:obj) -> string

Runs the template with the specified name.

Returns: The string result of the template.

Run(name, model)
Signature: (name:string * model:'T) -> string
Type parameters: 'T

Runs the template with the specified name.

Returns: The string result of the template.

SetTemplateService(service)
Signature: service:ITemplateService -> unit

Sets the template service.

Fork me on GitHub