Show / Hide Table of Contents

Class MvcContextBuilderProvider

Implementation of IGetsRootContextBuilder which sets up the 'root variables' which are made available to ZPT MVC5 views.

Inheritance
System.Object
MvcContextBuilderProviderBase
MvcContextBuilderProvider
Implements
IGetsRootContextBuilder
Inherited Members
MvcContextBuilderProviderBase.ViewContext
MvcContextBuilderProviderBase.ViewsPath
MvcContextBuilderProviderBase.GetRootContextBuilder()
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
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 Source

MvcContextBuilderProvider(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 Source

BuildContext(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
MvcContextBuilderProviderBase.BuildContext(IConfiguresRootContext, IServiceProvider)
| Improve this Doc View Source

GetUrl()

Gets the Uri to the current HTTP request.

Declaration
protected override Uri GetUrl()
Returns
Type Description
System.Uri

The request Uri.

Overrides
MvcContextBuilderProviderBase.GetUrl()
| Improve this Doc View Source

GetViewsObject()

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
MvcContextBuilderProviderBase.GetViewsObject()
Remarks

The views object provides access to the root directory which contains all of the views for the application.

Implements

IGetsRootContextBuilder
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX