Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Model binding - parameter name aliasing #563

Closed
kichalla opened this issue May 25, 2014 · 2 comments
Closed

Model binding - parameter name aliasing #563

kichalla opened this issue May 25, 2014 · 2 comments

Comments

@kichalla
Copy link
Member

Scenario:
A rest route like {controller}/{id?} could be used by multiple controllers. Each controller might want to use a different parameter name for id (ex: customerId, orderId) in their actions.

We need an aliasing feature (for example, Web API has a Name property on the FromUri 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.

@yishaigalatzer
Copy link
Contributor

This is relevant for all routes, not just rest routes.

@yishaigalatzer yishaigalatzer changed the title Provide parameter name aliasing to allow users have different parameter names from route or query variable names Model binding - parameter name aliasing May 28, 2014
@yishaigalatzer yishaigalatzer added this to the 1.0.0-alpha2 milestone May 28, 2014
@pranavkm pranavkm removed their assignment Jun 11, 2014
@danroth27 danroth27 modified the milestones: 6.0.0-alpha2, 1.0.0-alpha2 Jul 7, 2014
@danroth27 danroth27 removed this from the 6.0.0-alpha2 milestone Aug 12, 2014
@danroth27 danroth27 added this to the 6.0.0-rc1 milestone Oct 15, 2014
@danroth27 danroth27 modified the milestones: 6.0.0-beta3, 6.0.0-rc1 Jan 15, 2015
@harshgMSFT harshgMSFT self-assigned this Jan 23, 2015
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.
@harshgMSFT
Copy link
Contributor

85b6382

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants