Skip to content
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

Enhancements on LinkGenerator and TemplateBinder #19395

Closed
yang-er opened this issue Feb 27, 2020 · 2 comments
Closed

Enhancements on LinkGenerator and TemplateBinder #19395

yang-er opened this issue Feb 27, 2020 · 2 comments
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. Status: Resolved
Milestone

Comments

@yang-er
Copy link

yang-er commented Feb 27, 2020

Is your feature request related to a problem? Please describe.

Ambient Value Invalidation is one of breaking changes from Endpoint Routing.

With the current algorithm, anchor links for /[area=project]/{projectid}/[controller=...]/[action=...] is more complicated. I have to attach asp-route-projectid="some..." to each tag.

After I read the source code for Microsoft.AspNetCore.Routing.Template.TemplateBinder, I found that if projectid can be added into _requiredKeys, this problem will no longer exists.

Describe the solution you'd like

Create a new Attribute for Endpoint Metadata, which contains the route tokens to add into _requiredKeys. And when generating TemplateBinders, use these attributes to build that array.

Additional context

Well, if I make the _requiredKeys an empty array through reflection, it will become the behavior in ASP.NET Core 2.1 and earlier. Maybe an alternative compatibility property in MvcOptions also works? This really slow down my work for upgrading to ASP.NET Core 3.x. And the solution in the second section doesn't really bother the Endpoint Routing system.

@Pilchie Pilchie added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Feb 27, 2020
@mkArtakMSFT
Copy link
Member

Thanks for contacting us, @yang-er.
This is not something we plan to do as we've intentionally stepped away from that model.
/cc @rynowak

@mkArtakMSFT mkArtakMSFT added the ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. label Mar 3, 2020
@ghost ghost added the Status: Resolved label Mar 3, 2020
@mkArtakMSFT mkArtakMSFT added this to the Discussions milestone Mar 3, 2020
@ghost
Copy link

ghost commented Mar 24, 2020

This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes.

See our Issue Management Policies for more information.

@ghost ghost closed this as completed Mar 24, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Apr 23, 2020
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. Status: Resolved
Projects
None yet
Development

No branches or pull requests

3 participants