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
public static class RenderingEngineOptionsExtensions : Object

Methods

AddDefaultComponentRenderer(RenderingEngineOptions)

Maps a default IComponentRenderer.

Declaration
public static RenderingEngineOptions AddDefaultComponentRenderer(this RenderingEngineOptions options)
Parameters
TypeNameDescription
RenderingEngineOptionsoptionsThe RenderingEngineOptions to configure.
Returns
TypeDescription
RenderingEngineOptionsThe RenderingEngineOptions so that additional calls can be chained.

AddDefaultComponentRenderer(RenderingEngineOptions)

Maps a default IComponentRenderer.

Declaration
public static RenderingEngineOptions AddDefaultComponentRenderer<T>(this RenderingEngineOptions options)
    where T : IComponentRenderer
Parameters
TypeNameDescription
RenderingEngineOptionsoptionsThe RenderingEngineOptions to configure.
Returns
TypeDescription
RenderingEngineOptionsThe RenderingEngineOptions so that additional calls can be chained.
Type Parameters
NameDescription
TThe 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
public static RenderingEngineOptions AddDefaultPartialView(this RenderingEngineOptions options, string partialViewPath)
Parameters
TypeNameDescription
RenderingEngineOptionsoptionsThe RenderingEngineOptions to configure.
System.StringpartialViewPathThe path of the partial view.
Returns
TypeDescription
RenderingEngineOptionsThe RenderingEngineOptions so that additional calls can be chained.

AddModelBoundView(RenderingEngineOptions, Predicate, String)

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

Declaration
public static RenderingEngineOptions AddModelBoundView<TModel>(this RenderingEngineOptions options, Predicate<string> match, string viewName)
Parameters
TypeNameDescription
RenderingEngineOptionsoptionsThe RenderingEngineOptions to configure.
System.Predicate

<

System.String

>
matchA predicate to use when attempting to match a layout component.
System.StringviewNameThe view name.
Returns
TypeDescription
RenderingEngineOptionsThe RenderingEngineOptions so that additional calls can be chained.
Type Parameters
NameDescription
TModelThe model type to use for view binding.

AddModelBoundView(RenderingEngineOptions, String)

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

Declaration
public static RenderingEngineOptions AddModelBoundView<TModel>(this RenderingEngineOptions options, string viewName)
Parameters
TypeNameDescription
RenderingEngineOptionsoptionsThe RenderingEngineOptions to configure.
System.StringviewNameThe 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
RenderingEngineOptionsThe RenderingEngineOptions so that additional calls can be chained.
Type Parameters
NameDescription
TModelThe model type to use for view binding.

AddModelBoundView(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
public static RenderingEngineOptions AddModelBoundView<TModel>(this RenderingEngineOptions options, string layoutComponentName, string viewName)
Parameters
TypeNameDescription
RenderingEngineOptionsoptionsThe RenderingEngineOptions to configure.
System.StringlayoutComponentNameThe name of the layout component.
System.StringviewNameThe view name.
Returns
TypeDescription
RenderingEngineOptionsThe RenderingEngineOptions so that additional calls can be chained.
Type Parameters
NameDescription
TModelThe model type to use for view binding.

AddPartialView(RenderingEngineOptions, Predicate, String)

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

Declaration
public static RenderingEngineOptions AddPartialView(this RenderingEngineOptions options, Predicate<string> match, string partialViewPath)
Parameters
TypeNameDescription
RenderingEngineOptionsoptionsThe RenderingEngineOptions to configure.
System.Predicate

<

System.String

>
matchThe predicate to use when attempting to match a layout component.
System.StringpartialViewPathThe path of the partial view.
Returns
TypeDescription
RenderingEngineOptionsThe 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
public static RenderingEngineOptions AddPartialView(this RenderingEngineOptions options, string partialViewPath)
Parameters
TypeNameDescription
RenderingEngineOptionsoptionsThe RenderingEngineOptions to configure.
System.StringpartialViewPathThe path of the partial view. The file name of the partial view will be the registered Sitecore layout component name.
Returns
TypeDescription
RenderingEngineOptionsThe 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
public static RenderingEngineOptions AddPartialView(this RenderingEngineOptions options, string layoutComponentName, string partialViewPath)
Parameters
TypeNameDescription
RenderingEngineOptionsoptionsThe RenderingEngineOptions to configure.
System.StringlayoutComponentNameThe name of the layout component.
System.StringpartialViewPathThe path of the partial view.
Returns
TypeDescription
RenderingEngineOptionsThe RenderingEngineOptions so that additional calls can be chained.

AddPostRenderingAction(RenderingEngineOptions, Action)

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

Declaration
public static RenderingEngineOptions AddPostRenderingAction(this RenderingEngineOptions options, Action<HttpContext> postAction)
Parameters
TypeNameDescription
RenderingEngineOptionsoptionsThe RenderingEngineOptions to configure.
System.Action

<

Microsoft.AspNetCore.Http.HttpContext

>
postActionThe action to execute after rendering engine/>.
Returns
TypeDescription
RenderingEngineOptionsThe RenderingEngineOptions so that additional calls can be chained.

AddViewComponent(RenderingEngineOptions, Predicate, String)

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

Declaration
public static RenderingEngineOptions AddViewComponent(this RenderingEngineOptions options, Predicate<string> match, string viewComponentName)
Parameters
TypeNameDescription
RenderingEngineOptionsoptionsThe RenderingEngineOptions to configure.
System.Predicate

<

System.String

>
matchA predicate to use when attempting to match a layout component.
System.StringviewComponentNameThe view component name.
Returns
TypeDescription
RenderingEngineOptionsThe RenderingEngineOptions so that additional calls can be chained.

AddViewComponent(RenderingEngineOptions, String)

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

Declaration
public static RenderingEngineOptions AddViewComponent(this RenderingEngineOptions options, string viewComponentName)
Parameters
TypeNameDescription
RenderingEngineOptionsoptionsThe RenderingEngineOptions to configure.
System.StringviewComponentNameThe view component name. This is also used as the layout component registration name.
Returns
TypeDescription
RenderingEngineOptionsThe RenderingEngineOptions so that additional calls can be chained.

AddViewComponent(RenderingEngineOptions, String, String)

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

Declaration
public static RenderingEngineOptions AddViewComponent(this RenderingEngineOptions options, string layoutComponentName, string viewComponentName)
Parameters
TypeNameDescription
RenderingEngineOptionsoptionsThe RenderingEngineOptions to configure.
System.StringlayoutComponentNameThe name of the layout component.
System.StringviewComponentNameThe view component name.
Returns
TypeDescription
RenderingEngineOptionsThe RenderingEngineOptions so that additional calls can be chained.

MapToRequest(RenderingEngineOptions, Action<HttpRequest, SitecoreLayoutRequest>)

Adds SitecoreLayoutRequest mapping action.

Declaration
public static RenderingEngineOptions MapToRequest(this RenderingEngineOptions options, Action<HttpRequest, SitecoreLayoutRequest> mapAction)
Parameters
TypeNameDescription
RenderingEngineOptionsoptionsThe RenderingEngineOptions to configure.
System.Action

<

Microsoft.AspNetCore.Http.HttpRequest

,

SitecoreLayoutRequest

>
mapActionThe mapping action to configure SitecoreLayoutRequest.
Returns
TypeDescription
RenderingEngineOptionsThe RenderingEngineOptions so that additional calls can be chained.
If you have suggestions for improving this article, let us know!