TagHelperExecutionContext Class

Class used to store information about a Microsoft.AspNetCore.Razor.TagHelpers.ITagHelper‘s execution lifetime.

Namespace
Microsoft.AspNetCore.Razor.Runtime.TagHelpers
Assemblies
  • Microsoft.AspNetCore.Razor.Runtime

Syntax

public class TagHelperExecutionContext
class Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext

Constructors

TagHelperExecutionContext(System.String, Microsoft.AspNetCore.Razor.TagHelpers.TagMode, System.Collections.Generic.IDictionary<System.Object, System.Object>, System.String, System.Func<System.Threading.Tasks.Task>, System.Action<System.Text.Encodings.Web.HtmlEncoder>, System.Func<Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContent>)

Instantiates a new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.

Arguments:
  • tagName (System.String) – The HTML tag name in the Razor source.
  • tagMode (Microsoft.AspNetCore.Razor.TagHelpers.TagMode) – HTML syntax of the element in the Razor source.
  • items (System.Collections.Generic.IDictionary<System.Object>) – The collection of items used to communicate with other Microsoft.AspNetCore.Razor.TagHelpers.ITagHelpers
  • uniqueId (System.String) – An identifier unique to the HTML element this context is for.
  • executeChildContentAsync (System.Func<System.Threading.Tasks.Task>) – A delegate used to execute the child content asynchronously.
  • startTagHelperWritingScope (System.Action<System.Text.Encodings.Web.HtmlEncoder>) – A delegate used to start a writing scope in a Razor page and optionally override the page’s System.Text.Encodings.Web.HtmlEncoder within that scope.
  • endTagHelperWritingScope (System.Func<Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContent>) – A delegate used to end a writing scope in a Razor page.
public TagHelperExecutionContext(string tagName, TagMode tagMode, IDictionary<object, object> items, string uniqueId, Func<Task> executeChildContentAsync, Action<HtmlEncoder> startTagHelperWritingScope, Func<TagHelperContent> endTagHelperWritingScope)

Methods

Add(Microsoft.AspNetCore.Razor.TagHelpers.ITagHelper)

Tracks the given <em>tagHelper</em>.

Arguments:tagHelper (Microsoft.AspNetCore.Razor.TagHelpers.ITagHelper) – The tag helper to track.
public void Add(ITagHelper tagHelper)
AddHtmlAttribute(Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute)

Tracks the HTML attribute.

Arguments:attribute (Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute) – The Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute to track.
public void AddHtmlAttribute(TagHelperAttribute attribute)
AddHtmlAttribute(System.String, System.Object, Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle)

Tracks the HTML attribute.

Arguments:
public void AddHtmlAttribute(string name, object value, HtmlAttributeValueStyle valueStyle)
AddTagHelperAttribute(Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute)

Tracks the Microsoft.AspNetCore.Razor.TagHelpers.ITagHelper bound attribute.

Arguments:attribute (Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute) – The bound attribute.
public void AddTagHelperAttribute(TagHelperAttribute attribute)
AddTagHelperAttribute(System.String, System.Object, Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle)

Tracks the Microsoft.AspNetCore.Razor.TagHelpers.ITagHelper bound attribute.

Arguments:
public void AddTagHelperAttribute(string name, object value, HtmlAttributeValueStyle valueStyle)
Reinitialize(System.String, Microsoft.AspNetCore.Razor.TagHelpers.TagMode, System.Collections.Generic.IDictionary<System.Object, System.Object>, System.String, System.Func<System.Threading.Tasks.Task>)

Clears the Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext and updates its state with the provided values.

Arguments:
public void Reinitialize(string tagName, TagMode tagMode, IDictionary<object, object> items, string uniqueId, Func<Task> executeChildContentAsync)
SetOutputContentAsync()

Executes children asynchronously with the page’s System.Text.Encodings.Web.HtmlEncoder in scope and sets Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.Output‘s Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput.Content to the rendered results.

Return type:System.Threading.Tasks.Task
Returns:A System.Threading.Tasks.Task that on completion sets Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.Output‘s Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput.Content to the children’s rendered content.
public Task SetOutputContentAsync()

Properties

Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.ChildContentRetrieved

Indicates if Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.GetChildContentAsync(System.Boolean,System.Text.Encodings.Web.HtmlEncoder) has been called.

Return type:System.Boolean
public bool ChildContentRetrieved { get; }
Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.Context

The Microsoft.AspNetCore.Razor.TagHelpers.ITagHelper‘s context.

Return type:Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext
public TagHelperContext Context { get; }
Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.Items

Gets the collection of items used to communicate with other Microsoft.AspNetCore.Razor.TagHelpers.ITagHelpers.

Return type:System.Collections.Generic.IDictionary<System.Object>
public IDictionary<object, object> Items { get; }
Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.Output

The Microsoft.AspNetCore.Razor.TagHelpers.ITagHelper‘s output.

Return type:Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput
public TagHelperOutput Output { get; }
Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.TagHelpers

Microsoft.AspNetCore.Razor.TagHelpers.ITagHelpers that should be run.

Return type:System.Collections.Generic.IList<Microsoft.AspNetCore.Razor.TagHelpers.ITagHelper>
public IList<ITagHelper> TagHelpers { get; }