RazorEngine


TemplateService

Defined in RazorEngine.dll.

Defines a template service.

Constructors

ConstructorDescription
new(config)
Signature: config:ITemplateServiceConfiguration -> unit

Initialises a new instance of TemplateService

new()
Signature: unit -> unit

Initialises a new instance of TemplateService.

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 ExecuteContext

Returns:

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

Creates an instance of ITemplate from the specified string template.

Returns: An instance of .

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

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

Returns: The enumerable set of template instances.

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

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

Returns: An instance of .

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

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

Returns: The set of instances.

EncodedStringFactory
Signature: IEncodedStringFactory
Modifiers: abstract

Gets the encoded string factory.

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

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:obj * name:string) -> ITemplate
Modifiers: abstract
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> * models:IEnumerable<obj> * names:IEnumerable<string> * parallel:bool) -> IEnumerable<ITemplate>
Modifiers: abstract

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.

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> * names:IEnumerable<string> * parallel:bool) -> IEnumerable<string>
Modifiers: abstract

Parses the specified set of templates.

Returns: The set of parsed template results.

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

NOT SUPPORTED.

Returns:

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 template with the specified name.

Returns: The string result of the template.

Fork me on GitHub