Using ASP.NET Core Tag Helpers to Process Call ProcessAsync or some other way?
I cannot find the source code for the TagHelper method in the asp.net MVC source. I am trying to understand the relationship between them. I noticed that only ProcessAsync is required for the ITagHelper interface, so I think Process should somehow call ProcessAsync, but I would like to search for that in the source to understand better.
https://docs.microsoft.com/en-us/aspnet/core/api/microsoft.aspnetcore.razor.taghelpers.itaghelper
source to share
I think you see a method Process
that actually comes from TagHelper
that implements ITagHelper
and adds Process
as a virtual method. The XML comment says:
Executes TagHelper synchronously with the specified context and exit.
So it is entirely up to the tag helper how to implement these methods. One of the options, as you think, could be called another. The implementation depends entirely on the component itself. However, the XML comments on the async method define this:
ProcessAsync: By default this calls
Process
And the code shows how it works:
public virtual Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
Process(context, output);
return TaskCache.CompletedTask;
}
source to share