Adds IRouterHandler, an abstraction for endpoints in the routing system
that can't chain (example: delegates). The idea is that some kinds of
routes aren't really friendly to chaining. If you don't support chaining,
then accept IRouteHandler and work with that rather than IRouter.
There's one implementation of IRouteHandler, RouteHandler. It implements
both IRouter and IRouteHandler.
Adds RouteBase as a base class for routes based on our template syntax and
defaults/constraints/data-tokens. Updated a lot of signatures to be
get/set virtual and mutable to facilitate or bigger variety of usage
scenarios.
Renamed TemplateRoute to just Route, now inherits from RouteBase.
Adds IRoutingFeature for middleware scenarios where you don't have access
to the route context.
Also adds some basic extension methods for accessing route values.
- `DefaultInlineConstraintResolver` has no need of a `IServiceProvider`
nits:
- add doc comments for changed `DefaultInlineConstraintResolver` ctor
- let VS add a dev server port to sample's .kproj
- add debugSettings.json and .vs/ to .gitignore
This is a sample of the pattern for building a MapRoute method that
customizes routing by adding constraints, datatokens, or defaults. This is
the replacement for adding data to the route directly.
Also fixed up the sample to work. It was massively out of date.
This is useful for a variety of interesting scenarios in link generation
where a default value doesn't appear in the route template as a parameter.
This can be used to implement the desired behavior for areas - where the
'area' key is sticky.
This is the routing part of these changes, and just the breaking changes
parts.
Follow-ups will add:
- DataTokens
- Tracking the logical stack of routers
Moving out Default Handler and IInlineConstraintResolver from RouteCollection.
These are moved to a new interface IRouteBuilder, (instead of an IInlineConstraintResolver, it takes in an IServiceProvider).
This means all RouteCollectionExtensions are moved to RouteBuilderExtensions.