You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
Should Html.PrimeCache be named Html.PrimeCacheAsync? #246
MVC APIs that return Task/Task<T> have the Async suffix, e.g. Html.PartialAsync.
For consistency with MVC APIs and as an indicator to developers that they should @await the result, shouldn't Html.PrimeCache be named Html.PrimeCacheAsync?
While you're at it, maybe the new overload should return Task<IHtmlContent> instead of Task<HtmlString> (like Html.PartialAsync), which would allow the results to be written to a TextWriter instead of having to concatenate/format/allocate a (potentially large) string to return with HtmlString? HtmlString itself implements IHtmlContent so the existing implementation could remain as-is for now; returning Task<IHtmlContent> leaves the door open to perf improvements in the future.
Implemented. As per your suggestion, also changed the return type to Task<IHtmlContent>. Currently it's still using HtmlString but could change to a custom less-allocatey alternative like your prototype in the future.
MVC APIs that return
Task/Task<T>have theAsyncsuffix, e.g.Html.PartialAsync.For consistency with MVC APIs and as an indicator to developers that they should
@awaitthe result, shouldn'tHtml.PrimeCachebe namedHtml.PrimeCacheAsync?