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.
Activity
SteveSandersonMS commentedon Aug 8, 2016
Yes, I think you're right! Will add that as a new overload and will mark the old one as obsolete.
justinvp commentedon Aug 8, 2016
While you're at it, maybe the new overload should return
Task<IHtmlContent>instead ofTask<HtmlString>(likeHtml.PartialAsync), which would allow the results to be written to aTextWriterinstead of having to concatenate/format/allocate a (potentially large) string to return withHtmlString?HtmlStringitself implementsIHtmlContentso the existing implementation could remain as-is for now; returningTask<IHtmlContent>leaves the door open to perf improvements in the future.justinvp commentedon Aug 8, 2016
(To give you an idea, I prototyped some potential changes to the existing implementation earlier this weekend: 4c7bdcf)
SteveSandersonMS commentedon Aug 16, 2016
Implemented. As per your suggestion, also changed the return type to
Task<IHtmlContent>. Currently it's still usingHtmlStringbut could change to a custom less-allocatey alternative like your prototype in the future.Merge remote-tracking branch 'upstream/dev' into dev