Click or drag to resize
HandlebarsViewSetupContext Method
Creates the context (Handlebars lingo for the model) and stores references to the ViewData and ViewContext.

Namespace: HandlebarsDotNet.Mvc
Assembly: HandlebarsDotNet.Mvc (in HandlebarsDotNet.Mvc.dll) Version: 1.0.0-beta
Syntax
protected virtual Object SetupContext(
	ViewContext viewContext
)

Parameters

viewContext
Type: ViewContext
The ViewContext that contains the model.

Return Value

Type: Object
A newly created context that will be used as the model for views and layouts in HandlebarsDotNet.
Remarks
This method constructs a context object from viewContext.ViewData.Model.
The context will have a few extra properties added and those are:
"viewbag" - so a view file can use {{viewbag.title}} for example to output a ViewBag.Title property that was set in the controller,
and the other one is named in an obscure way (to minimize name clash with user properties) and contains the ViewContext that was passed to this method.

Helpers may need to get ahold of the ViewContext and in those cases they can use the HandlebarsView.GetViewContext() static method.

See Also