public sealed override void Process(TagHelperContext context, TagHelperOutput output) { ControlOutputContext controlOutputContext = this.GetContext(context, output); if (this.EnsureRenderer(controlOutputContext)) { this.Process(controlOutputContext); context.Items[ControlTagHelper.RandomContextKey] = controlOutputContext; } }
public sealed override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { ControlOutputContext currentContext = this.GetContext(context, output); if (this.EnsureRenderer(currentContext)) { context.Items[ControlTagHelper.RandomContextKey] = currentContext; _ = await output.GetChildContentAsync(); await this.ProcessAsync(currentContext); } }
private ControlOutputContext GetContext(TagHelperContext tagHelperContext, TagHelperOutput output) { string id = ControlTagHelper.GetOrGenerateControlId(output); ControlOutputContext currentContext = new ControlOutputContext(id, output) { Control = this }; if (tagHelperContext.Items.TryGetValue(ControlTagHelper.RandomContextKey, out object obj)) { ControlOutputContext parentContext = obj as ControlOutputContext; currentContext.Parent = parentContext; parentContext.Children.Add(currentContext); } return(currentContext); }