[Bind(Prefix = "...")] attribute shoud rewrite route parameter names
btihanyi opened this issue · 1 comments
btihanyi commented
The [BindAttribute]
is a strange but useful way to "rename" action parameter names. If its Prefix
property is set, the routing system will use that name instead of the method's variable name. So if I write this:
public IActionResult Details([Bind(Prefix = "id")] productId)
{
...
}
Then the common "{controller=Home}/{action=Index}/{id?}"
will match this action method.
I know this is not a common scenario, but I've used a lot in our MVC project, so this should be implemented in order to be able to upgrade to ASP.NET Core. For that reason, I'm going to add a pull request for this feature.
artiomchi commented
The PR was merged, with a couple adjustments, and will try to get a release soon