Open
Description
The tag helpers are working as expected and the mvc-action
currently supports both synchronous and async actions. The issue is that these two types of actions have a different return type (IActionResult
vs Task<IActionResult>
)
In the tag helper code I've set the type of that attribute as object
to allow both types of methods to be accepted, and am type checking when generating the url, but that doesn't seem ideal.
I've added additional "fake" attributes with the same name, which gives me the benefit of showing the other accepted action result types in intellisense, which is my current workaround.
Options that I came up with so far are:
- Leave it as is. The value type of the attribute is
object
, but it accepts all actions in a consistent way, and the intellisense provides users with hints on data types - Generate separate attributes for synchronous and async actions.
For examplemvc-action
andmvc-action-async
- Only support
IActionResult
in the tag helpers. For async actions, users will have to invoke.Result
<a mvc-action="MVC.Home.Index().Result">Async Index</a>
I'm interested to know what others thing would work best