RazorEngine


TemplateBase

Defined in RazorEngine.dll.

Provides a base implementation of a template. NOTE: This class is not serializable to prevent subtle errors in user IActivator implementations which would break the sandbox. (because executed in the wrong AppDomain)

Constructors

ConstructorDescription
new()
Signature: unit -> unit

Initialises a new instance of TemplateBase.

Instance members

Instance memberDescription
CurrentWriter
Signature: TextWriter

Gets the current writer.

DefineSection(name, action)
Signature: (name:string * action:Action) -> unit

Defines a section that can written out to a layout.

Execute()
Signature: unit -> unit
Modifiers: abstract

Executes the compiled template.

Include(name, model, modelType)
Signature: (name:string * model:obj * modelType:Type) -> TemplateWriter
Modifiers: abstract

Includes the template with the specified name.

Returns: The template writer helper.

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

Determines if the section with the specified name has been defined.

Returns:

Layout()
Signature: unit -> unit

Gets or sets the layout template name.

Raw(rawString)
Signature: rawString:string -> IEncodedString

Returns the specified string as a raw string. This will ensure it is not encoded.

Returns: An instance of .

Razor()
Signature: unit -> unit
Modifiers: abstract

Gets or sets the current IRazorEngineService instance.

RazorEngine()
Signature: unit -> unit
Modifiers: abstract

Gets or sets the current IRazorEngineService instance.

RenderBody()
Signature: unit -> TemplateWriter

Renders the body of the template.

Returns: The template writer helper.

RenderSection(name, required)
Signature: (name:string * required:bool) -> TemplateWriter
Modifiers: abstract

Renders the section with the specified name.

Returns: The template writer helper.

ResolveUrl(path)
Signature: path:string -> string
Modifiers: abstract

Resolves the specified path

Returns: The resolved path.

set_InternalTemplateService(value)
Signature: value:IInternalTemplateService -> unit
Modifiers: abstract
SetData(model, viewbag)
Signature: (model:obj * viewbag:DynamicViewBag) -> unit
Modifiers: abstract

Set the data for this template.

SetModel(model)
Signature: model:obj -> unit
Modifiers: abstract

Set the current model.

TemplateService()
Signature: unit -> unit
Modifiers: abstract

Gets or sets the template service.

ViewBag
Signature: obj

Gets the viewbag that allows sharing state between layout and child templates.

Write(value)
Signature: value:obj -> unit
Modifiers: abstract

Writes the specified object to the result.

Write(helper)
Signature: helper:TemplateWriter -> unit
Modifiers: abstract

Writes the specified template helper result.

WriteAttribute(...)
Signature: (name:string * prefix:PositionTagged<string> * suffix:PositionTagged<string> * values:AttributeValue []) -> unit
Modifiers: abstract

Writes an attribute to the result.

WriteAttributeTo(...)
Signature: (writer:TextWriter * name:string * prefix:PositionTagged<string> * suffix:PositionTagged<string> * values:AttributeValue []) -> unit
Modifiers: abstract

Writes an attribute to the specified TextWriter.

WriteLiteral(literal)
Signature: literal:string -> unit
Modifiers: abstract

Writes the specified string to the result.

WriteLiteralTo(writer, literal)
Signature: (writer:TextWriter * literal:string) -> unit
Modifiers: abstract

Writes a string literal to the specified TextWriter.

WriteTo(writer, value)
Signature: (writer:TextWriter * value:obj) -> unit
Modifiers: abstract

Writes the specified object to the specified TextWriter.

WriteTo(writer, helper)
Signature: (writer:TextWriter * helper:TemplateWriter) -> unit
Modifiers: abstract

Writes the specfied template helper result to the specified writer.

Fork me on GitHub