SaaS CMS has officially launched! Learn more now.

Class ModelRenderingScope

A helper object that can be used when rendering a model in a content rendering context. It keeps track of which content that is currently rendered. This is needed to be able to output edit attributes for correct elements.

Inheritance
System.Object
ModelRenderingScope
Implements
System.IDisposable
Namespace: EPiServer.Web.Templating
Assembly: EPiServer.Cms.AspNetCore.Templating.dll
Version: 12.0.3
Syntax
public class ModelRenderingScope : Object, IDisposable
Remarks

This class implements System.IDisposable and instances should be used inside a using statement.

Constructors

ModelRenderingScope(HttpContext, Object, TemplateModel, IEnumerable<String>)

Initializes a new instance of the ContentRenderingScope class.

Declaration
public ModelRenderingScope(HttpContext context, object model, TemplateModel templateModel = null, IEnumerable<string> templateTags = null)
Parameters
Type Name Description
Microsoft.AspNetCore.Http.HttpContext context
System.Object model
TemplateModel templateModel
System.Collections.Generic.IEnumerable<System.String> templateTags

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
public void Dispose()

Dispose(Boolean)

Triggers the end element when disposing is true

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

true to write the end element.

PopCurrentModel(HttpContext, Object)

Pops the current content rendered from context. This is needed when rendering a content area since then the current rendered might differ from the routed content. So this method should be used in combination with PushCurrentModel(HttpContext, Object, TemplateModel, IEnumerable<String>).

Declaration
public static void PopCurrentModel(HttpContext context, object model)
Parameters
Type Name Description
Microsoft.AspNetCore.Http.HttpContext context
System.Object model
Remarks

PushCurrentModel(HttpContext, Object, TemplateModel, IEnumerable<String>)

Pushes the current content rendered to context. This is needed when rendering a content area since then the current rendered might differ from the routed content.

Declaration
public static void PushCurrentModel(HttpContext context, object model, TemplateModel templateModel, IEnumerable<string> templateTags = null)
Parameters
Type Name Description
Microsoft.AspNetCore.Http.HttpContext context
System.Object model
TemplateModel templateModel
System.Collections.Generic.IEnumerable<System.String> templateTags
Remarks

Implements

System.IDisposable

Extension Methods