This repository has been archived by the owner on Dec 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Model binding - parameter name aliasing #563
Comments
This is relevant for all routes, not just rest routes. |
harshgMSFT
added a commit
that referenced
this issue
Feb 10, 2015
…me which is used as a prefix. Also the name is used for reporting model state errors.
harshgMSFT
added a commit
that referenced
this issue
Feb 10, 2015
…me which is used as a prefix. Also the name is used for reporting model state errors.
harshgMSFT
added a commit
that referenced
this issue
Feb 16, 2015
…me which is used as a prefix. Also the name is used for reporting model state errors.
harshgMSFT
added a commit
that referenced
this issue
Feb 19, 2015
…me which is used as a prefix. Also the name is used for reporting model state errors.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Scenario:
A rest route like
{controller}/{id?}
could be used by multiple controllers. Each controller might want to use a different parameter name forid
(ex: customerId, orderId) in their actions.We need an aliasing feature (for example, Web API has a
Name
property on theFromUri
attribute) through which a user can supply a different name than the one defined on route variable.Web API example:
public IActionResult Get([FromUri(Name='id') int orderId])
Note:
The above scenario could probably be accomplished by using Attribute Routing where the route template can be defined close to the action with different variable names. But here we would be forcing users to use attribute routing which is not good.
Also action's parameter values could be coming from Query String or other custom value providers(ex: reading from Request Headers) and aliasing could be required in these scenarios too.
The text was updated successfully, but these errors were encountered: