You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 27, 2018. It is now read-only.
This change adds tests and makes the behavior consistent with legacy MVC
as far as what values are visible in constraints.
This is important because it allows constraints to make decisions based on
whether or not a value is present even if it's not in the template. This
is similar to the behavior of WebAPI link generation or Area link
generation in MVC 5 - but without hardcoding.
This change adds tests and makes the behavior consistent with legacy MVC
as far as what values are visible in constraints.
This is important because it allows constraints to make decisions based on
whether or not a value is present even if it's not in the template. This
is similar to the behavior of WebAPI link generation or Area link
generation in MVC 5 - but without hardcoding.
We accidentally changed this behavior from old MVC. This lets us do some pretty useful stuff with constraints so we should bring it back.
Here's an example (old MVC):
If you navigate to
/
then the second route will match, and produces the ambient values:{ controller = "Home", action = "Index" }
.Then inside that action, generate a link to another action
Url.Action("About")
.The inputs to link generation:
values:
{ action = "About" }
ambient values:
{ controller = "Home", action = "Index" }
When constraints are called, they see the 'accepted values:
{ controller = "Home", action = "About" }
Note that the value
foo = "bar"
is not present, even when running the first route's constraints.Now repeat, but navigate to
/slug
to match the first route, producing the ambient values:{ controller = "Home", action = "Index", foo = "bar" }
.Generate the same link:
values:
{ action = "About" }
ambient values:
{ controller = "Home", action = "Index", foo = "bar" }
When constraints are called, they see the 'accepted values:
{ controller = "Home", action = "About", foo = "bar" }
Note that
foo = "bar"
is present because it's an ambient value and not because it's a default value of the route.The text was updated successfully, but these errors were encountered: