Open
Description
I am trying to use custom route constraint in Blazor, similar to how it currently works for both razor pages and MVC routes:
services.AddRouting(options =>
{
options.ConstraintMap.Add("customName", typeof(MyCustomConstraint));
});
... but it appears that blazor route constraints do not consider any custom constraints that have been registered:
aspnetcore/src/Components/Components/src/Routing/RouteConstraint.cs
Lines 57 to 85 in af7c0cc
So I instead encounter the ArgumentException, "Unsupported constraint '{constraint}' in route '{template}'.".
It would be ideal if RouteConstraint
could be modified to reference RouteOptions.ContraintMap
as the other routing engines do. Alternatively, needing to use some Blazor-specific registration method to register constraints only for Blazor would also be acceptable.