Skip to content

Resolve parameter name with FromRouteAttribute in tooling #45720

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 22, 2022

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Dec 22, 2022

Minimal APIs and controller actions allow an argument to customize its matching route parameter name with [FromRoute(Name = "Test")].

This PR updates various route tooling bits to use the route name from the argument attribute.

@JamesNK JamesNK added the old-area-web-frameworks-do-not-use *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels label Dec 22, 2022
@ghost ghost added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Dec 22, 2022

public class TestController
{
[HttpGet(@""{id}"")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should decide if we need an analyzer to pick up when route parameters are missing from the route pattern.

Copy link
Member

@mitchdenny mitchdenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Once this is merged I'll rework my PR to use the shared bits.

@JamesNK
Copy link
Member Author

JamesNK commented Dec 22, 2022

Did you mean to approve?

@JamesNK JamesNK merged commit 95c74fe into main Dec 22, 2022
@JamesNK JamesNK deleted the jamesnk/usefromrouteattribute branch December 22, 2022 23:47
@ghost ghost added this to the 8.0-preview1 milestone Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework old-area-web-frameworks-do-not-use *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants