RazorEngine


ITemplateService

Defined in RazorEngine.dll.

Defines the required contract for implementing a template service.

Instance members

Instance memberDescription
AddNamespace(ns)
Signature: ns:string -> unit
Modifiers: abstract

Adds a namespace that will be imported into the template.

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

Compiles the specified template.

Configuration
Signature: ITemplateServiceConfiguration
Modifiers: abstract

Gets the template service configuration.

CreateExecuteContext(viewBag)
Signature: viewBag:DynamicViewBag -> ExecuteContext
Modifiers: abstract

Creates a new ExecuteContext used to tracking templates.

Returns: The instance of

CreateTemplate(...)
Signature: (razorTemplate:string * templateType:Type * model:obj) -> ITemplate
Modifiers: abstract

Create a template from the given razor code.

Returns:

CreateTemplates(...)
Signature: (razorTemplates:IEnumerable<string> * templateTypes:IEnumerable<Type> * models:IEnumerable<obj> * parallel:bool) -> IEnumerable<ITemplate>
Modifiers: abstract

Create a sequence of templates

Returns:

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

Backwards Compat

Returns:

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

Backwards Compat

Returns:

EncodedStringFactory
Signature: IEncodedStringFactory
Modifiers: abstract

Gets the encoded string factory.

GetTemplate(...)
Signature: (razorTemplate:string * model:obj * cacheName:string) -> ITemplate
Modifiers: abstract

Get a given template (compiles the templates if not cached already)

Returns:

GetTemplates(...)
Signature: (razorTemplates:IEnumerable<string> * models:IEnumerable<obj> * cacheNames:IEnumerable<string> * parallel:bool) -> IEnumerable<ITemplate>
Modifiers: abstract

See GetTemplate.

Returns:

HasTemplate(name)
Signature: name:string -> bool
Modifiers: abstract

Returns whether or not a template by the specified name has been created already.

Returns: Whether or not the template has been created.

Parse(...)
Signature: (razorTemplate:string * model:obj * viewBag:DynamicViewBag * cacheName:string) -> string
Modifiers: abstract

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 * cacheName:string) -> string
Modifiers: abstract
Type parameters: 'T

Parses and returns the result of the specified string template.

Returns: The string result of the template.

ParseMany(...)
Signature: (razorTemplates:IEnumerable<string> * models:IEnumerable<obj> * viewBags:IEnumerable<DynamicViewBag> * cacheNames:IEnumerable<string> * parallel:bool) -> IEnumerable<string>
Modifiers: abstract

Parses the specified set of templates.

Returns: The set of parsed template results.

Returns:

RemoveTemplate(cacheName)
Signature: cacheName:string -> bool
Modifiers: abstract

Remove a template by the specified name from the cache.

Returns: Whether or not the template has been removed.

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

Resolves the template with the specified name.

Returns: The resolved template.

Run(name, model, viewBag)
Signature: (name:string * model:obj * viewBag:DynamicViewBag) -> string
Modifiers: abstract

Runs the template with the specified name.

Returns: The string result of the template.

Run(template, viewBag)
Signature: (template:ITemplate * viewBag:DynamicViewBag) -> string
Modifiers: abstract

Runs the specified name.

Returns: The string result of the template.

Fork me on GitHub