Class RenderingEngineOptionsExtensions

Version: 21.x

Extensions to help configure RenderingEngineOptions.

Inheritance
System.Object
RenderingEngineOptionsExtensions
Namespace: Sitecore.AspNet.RenderingEngine.Extensions
Assembly: Sitecore.AspNet.RenderingEngine.dll
Syntax
RequestResponse
public static class RenderingEngineOptionsExtensions : Object

Methods

AddDefaultComponentRenderer(RenderingEngineOptions)

Maps a default IComponentRenderer.

Declaration
RequestResponse
public static RenderingEngineOptions AddDefaultComponentRenderer(this RenderingEngineOptions options)
Parameters
TypeNameDescription
RenderingEngineOptionsoptions

The RenderingEngineOptions to configure.

Returns
TypeDescription
RenderingEngineOptions

The RenderingEngineOptions so that additional calls can be chained.

AddDefaultComponentRenderer<T>(RenderingEngineOptions)

Maps a default IComponentRenderer.

Declaration
RequestResponse
public static RenderingEngineOptions AddDefaultComponentRenderer<T>(this RenderingEngineOptions options)
    where T : IComponentRenderer
Parameters
TypeNameDescription
RenderingEngineOptionsoptions

The RenderingEngineOptions to configure.

Returns
TypeDescription
RenderingEngineOptions

The RenderingEngineOptions so that additional calls can be chained.

Type Parameters
NameDescription
T

The IComponentRenderer to use for the default renderer.

AddDefaultPartialView(RenderingEngineOptions, String)

Maps any unmatched Sitecore layout component to a default partial view. This provides a visual appearance when the Sitecore layout service returns a component name that no implementation exists for. The view will receive a Component model. Ensure this is registered last as this mapping will override any subsequent component registrations.

Declaration
RequestResponse
public static RenderingEngineOptions AddDefaultPartialView(this RenderingEngineOptions options, string partialViewPath)
Parameters
TypeNameDescription
RenderingEngineOptionsoptions

The RenderingEngineOptions to configure.

System.StringpartialViewPath

The path of the partial view.

Returns
TypeDescription
RenderingEngineOptions

The RenderingEngineOptions so that additional calls can be chained.

AddModelBoundView<TModel>(RenderingEngineOptions, Predicate<String>, String)

Maps a Sitecore layout component name to a partial view rendering, using the default Sitecore view component to model bind it.

Declaration
RequestResponse
public static RenderingEngineOptions AddModelBoundView<TModel>(this RenderingEngineOptions options, Predicate<string> match, string viewName)
Parameters
TypeNameDescription
RenderingEngineOptionsoptions

The RenderingEngineOptions to configure.

System.Predicate<System.String>match

A predicate to use when attempting to match a layout component.

System.StringviewName

The view name.

Returns
TypeDescription
RenderingEngineOptions

The RenderingEngineOptions so that additional calls can be chained.

Type Parameters
NameDescription
TModel

The model type to use for view binding.

AddModelBoundView<TModel>(RenderingEngineOptions, String)

Maps a Sitecore layout component name to a partial view rendering, using the default Sitecore view component to model bind it.

Declaration
RequestResponse
public static RenderingEngineOptions AddModelBoundView<TModel>(this RenderingEngineOptions options, string viewName)
Parameters
TypeNameDescription
RenderingEngineOptionsoptions

The RenderingEngineOptions to configure.

System.StringviewName

The view name and layout component name. If the view name is a full path, the view's file name will be the layout component name.

Returns
TypeDescription
RenderingEngineOptions

The RenderingEngineOptions so that additional calls can be chained.

Type Parameters
NameDescription
TModel

The model type to use for view binding.

AddModelBoundView<TModel>(RenderingEngineOptions, String, String)

Maps a Sitecore layout component name to a partial view rendering, using the default Sitecore view component to model bind it.

Declaration
RequestResponse
public static RenderingEngineOptions AddModelBoundView<TModel>(this RenderingEngineOptions options, string layoutComponentName, string viewName)
Parameters
TypeNameDescription
RenderingEngineOptionsoptions

The RenderingEngineOptions to configure.

System.StringlayoutComponentName

The name of the layout component.

System.StringviewName

The view name.

Returns
TypeDescription
RenderingEngineOptions

The RenderingEngineOptions so that additional calls can be chained.

Type Parameters
NameDescription
TModel

The model type to use for view binding.

AddPartialView(RenderingEngineOptions, Predicate<String>, String)

Maps a Sitecore layout component name to a partial view rendering. The view will receive a Component model.

Declaration
RequestResponse
public static RenderingEngineOptions AddPartialView(this RenderingEngineOptions options, Predicate<string> match, string partialViewPath)
Parameters
TypeNameDescription
RenderingEngineOptionsoptions

The RenderingEngineOptions to configure.

System.Predicate<System.String>match

The predicate to use when attempting to match a layout component.

System.StringpartialViewPath

The path of the partial view.

Returns
TypeDescription
RenderingEngineOptions

The RenderingEngineOptions so that additional calls can be chained.

AddPartialView(RenderingEngineOptions, String)

Maps a Sitecore layout component name to a partial view rendering. The view will receive a Component model.

Declaration
RequestResponse
public static RenderingEngineOptions AddPartialView(this RenderingEngineOptions options, string partialViewPath)
Parameters
TypeNameDescription
RenderingEngineOptionsoptions

The RenderingEngineOptions to configure.

System.StringpartialViewPath

The path of the partial view. The file name of the partial view will be the registered Sitecore layout component name.

Returns
TypeDescription
RenderingEngineOptions

The RenderingEngineOptions so that additional calls can be chained.

AddPartialView(RenderingEngineOptions, String, String)

Maps a Sitecore layout component name to a partial view rendering. The view will receive a Component model.

Declaration
RequestResponse
public static RenderingEngineOptions AddPartialView(this RenderingEngineOptions options, string layoutComponentName, string partialViewPath)
Parameters
TypeNameDescription
RenderingEngineOptionsoptions

The RenderingEngineOptions to configure.

System.StringlayoutComponentName

The name of the layout component.

System.StringpartialViewPath

The path of the partial view.

Returns
TypeDescription
RenderingEngineOptions

The RenderingEngineOptions so that additional calls can be chained.

AddPostRenderingAction(RenderingEngineOptions, Action<HttpContext>)

Adds post rendering action to be executed after Rendering engine logic.

Declaration
RequestResponse
public static RenderingEngineOptions AddPostRenderingAction(this RenderingEngineOptions options, Action<HttpContext> postAction)
Parameters
TypeNameDescription
RenderingEngineOptionsoptions

The RenderingEngineOptions to configure.

System.Action<Microsoft.AspNetCore.Http.HttpContext>postAction

The action to execute after rendering engine/>.

Returns
TypeDescription
RenderingEngineOptions

The RenderingEngineOptions so that additional calls can be chained.

AddViewComponent(RenderingEngineOptions, Predicate<String>, String)

Maps a Sitecore layout component name to a view component rendering.

Declaration
RequestResponse
public static RenderingEngineOptions AddViewComponent(this RenderingEngineOptions options, Predicate<string> match, string viewComponentName)
Parameters
TypeNameDescription
RenderingEngineOptionsoptions

The RenderingEngineOptions to configure.

System.Predicate<System.String>match

A predicate to use when attempting to match a layout component.

System.StringviewComponentName

The view component name.

Returns
TypeDescription
RenderingEngineOptions

The RenderingEngineOptions so that additional calls can be chained.

AddViewComponent(RenderingEngineOptions, String)

Maps a Sitecore layout component name to a view component rendering.

Declaration
RequestResponse
public static RenderingEngineOptions AddViewComponent(this RenderingEngineOptions options, string viewComponentName)
Parameters
TypeNameDescription
RenderingEngineOptionsoptions

The RenderingEngineOptions to configure.

System.StringviewComponentName

The view component name. This is also used as the layout component registration name.

Returns
TypeDescription
RenderingEngineOptions

The RenderingEngineOptions so that additional calls can be chained.

AddViewComponent(RenderingEngineOptions, String, String)

Maps a Sitecore layout component name to a view component rendering.

Declaration
RequestResponse
public static RenderingEngineOptions AddViewComponent(this RenderingEngineOptions options, string layoutComponentName, string viewComponentName)
Parameters
TypeNameDescription
RenderingEngineOptionsoptions

The RenderingEngineOptions to configure.

System.StringlayoutComponentName

The name of the layout component.

System.StringviewComponentName

The view component name.

Returns
TypeDescription
RenderingEngineOptions

The RenderingEngineOptions so that additional calls can be chained.

MapToRequest(RenderingEngineOptions, Action<HttpRequest, SitecoreLayoutRequest>)

Adds SitecoreLayoutRequest mapping action.

Declaration
RequestResponse
public static RenderingEngineOptions MapToRequest(this RenderingEngineOptions options, Action<HttpRequest, SitecoreLayoutRequest> mapAction)
Parameters
TypeNameDescription
RenderingEngineOptionsoptions

The RenderingEngineOptions to configure.

System.Action<Microsoft.AspNetCore.Http.HttpRequest, SitecoreLayoutRequest>mapAction

The mapping action to configure SitecoreLayoutRequest.

Returns
TypeDescription
RenderingEngineOptions

The RenderingEngineOptions so that additional calls can be chained.

Do you have some feedback for us?

If you have suggestions for improving this article,