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
[Blazor] Unified server-side rendering and interactive routing (#49622)
* Unifies the routing implementation between ASP.NET Core routing and the Blazor interactive router.
* Adds support for:
* Complex segments.
* Default values.
* All the built-in constraints in ASP.NET Core.
* Enables the interactive router to reuse the results from the ASP.NET Core router.
* Updates the results of the ASP.NET Core router to match the specific Blazor interactive router quirks.
* Adding `null` for all the unused parameters in a given route group for a given handler.
* Adding `null` for all optional parameters that were not provided.
* Converting some constraint values to their "native" type.
* For example, a parameter with an `int` constraint gets converted to an integer from the parsed string.
* Includes an extensibility point to support third-party routers via dynamic routing.
Meaningful behavior changes are:
* Optional parameters won't throw if there are non-optional segments after them, the optionality will just be ignored.
* Matching constrained catch-alls won't match on a per segment basis. This behavior was different in Blazor routing and is really incompatible with the ASP.NET behavior, so we rather standardize on the ASP.NET behavior.
* To provide a concrete example, if you had `/{*catchall:int}` and the path /1/2/3/4/5, it would match on Blazor, but not on ASP.NET.
Implementation notes:
* We use TreeRouter which is the older implementation of the routing algorithm before we had the DFA, as it's a simpler and equally compatible/conformant implementation.
* We use `RoutePattern` directly instead of `RouteTemplate` as that's the most modern approach `(RouteTemplate is legacy from the ASP.NET times)`
* We don't share the resources dictionary from routing to avoid adding extra resources that are not used.
<value>The constructor to use for activating the constraint type '{0}' is ambiguous. Multiple constructors were found with the following number of parameters: {1}.</value>
<value>A route parameter uses the regex constraint, which isn't registered. If this application was configured using CreateSlimBuilder(...) or AddRoutingCore(...) then this constraint is not registered by default. To use the regex constraint, configure route options at app startup: services.Configure<RouteOptions>(options => options.SetParameterPolicy<RegexInlineRouteConstraint>("regex"));</value>
<value>The route parameter '{0}' has both an inline default value and an explicit default value specified. A route parameter cannot contain an inline default value when a default value is specified explicitly. Consider removing one of them.</value>
<value>The route parameter name '{0}' is invalid. Route parameter names must be non-empty and cannot contain these characters: '{{', '}}', '/'. The '?' character marks a parameter as optional, and can occur only at the end of the parameter. The '*' character marks a parameter as catch-all, and can occur only at the start of the parameter.</value>
<value>In the segment '{0}', the optional parameter '{1}' is preceded by an invalid segment '{2}'. Only a period (.) can precede an optional parameter.</value>
0 commit comments