Skip to content

Refactor Catch-All Router #281

Closed
Closed
@commonsensesoftware

Description

@commonsensesoftware

Overview

Prior to ASP.NET Core 2.0, the routing infrastructure could call IActionSelector multiple times. This led to a bug in API versioning in which the IActionSelector implementation made a final decision too early. The existing solution adds a catch-all route to the end of the pipeline which collects all candidates, API versions, and subsequently applies the final decision using the IApiVersionRoutePolicy.

While functional, this design has led to a number of unexpected complexities integrating other middleware.

Additional Considerations

The existing IApiVersionRoutePolicy should attempt to retain as much of the existing functionality as possible to ease the transition. Careful regression analysis must be done to ensure re-entrant action selection doesn't occur or that an accurate final decision is made without breaking existing behaviors.

Limitations

This feature was meant to fully remove the catch-all route, but the routing infrastructure in ASP.NET Core makes this impossible for the time being. The IActionSelector can still be called multiple times and will even be called multiple times for the same semantic route template where the only difference is route constraints.

At this time, the existing behaviors can be improved, but not completely supplanted. The changes to the design will, therefore, take a direction that will be ready to remove the catch-all router once routing improvements come to ASP.NET Core.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions