Class MvcContextBuilderProvider
Implementation of IGetsRootContextBuilder which sets up the 'root variables' which are made available to ZPT MVC5 views.
Implements
Inherited Members
Namespace: ZptSharp.Mvc5
Assembly: ZptSharp.Mvc5.dll
Syntax
public class MvcContextBuilderProvider : MvcContextBuilderProviderBase, IGetsRootContextBuilder
Remarks
This class adds a number of predefined global variables to the root of the TALES context, such that they are all available in ZPT views. Where possible, these mimic the same variables which would have been made available to Razor views. There are some small differences between MVC versions.
Some properties which would have been available to Razor views are excluded, especially where they are meaningless or do not make sense in the context of a ZPT view.
Note that the source for this class uses a number of 'compiler flags' (preprocessor directives) to cater for either MVC5 or MVC Core.
Constructors
| Improve this Doc View SourceMvcContextBuilderProvider(ViewContext, String)
Initializes a new instance of the MvcContextBuilderProvider class.
Declaration
public MvcContextBuilderProvider(ViewContext viewContext, string viewsPath)
Parameters
Type | Name | Description |
---|---|---|
System.Web.Mvc.ViewContext | viewContext | View context. |
System.String | viewsPath | Views path. |
Methods
| Improve this Doc View SourceBuildContext(IConfiguresRootContext, IServiceProvider)
Builds/adds-to the root TALES context using a helper.
Declaration
protected override void BuildContext(IConfiguresRootContext helper, IServiceProvider serviceProvider)
Parameters
Type | Name | Description |
---|---|---|
IConfiguresRootContext | helper | The helper object for adding to the root TALES context. |
System.IServiceProvider | serviceProvider | A service provider. |
Overrides
| Improve this Doc View SourceGetUrl()
Gets the Uri to the current HTTP request.
Declaration
protected override Uri GetUrl()
Returns
Type | Description |
---|---|
System.Uri | The request Uri. |
Overrides
| Improve this Doc View SourceGetViewsObject()
Gets an object which shall be used to fulfil the 'Views' global variable.
Declaration
protected override object GetViewsObject()
Returns
Type | Description |
---|---|
System.Object | The views object. |
Overrides
Remarks
The views object provides access to the root directory which contains all of the views for the application.