I am porting an existing ASP.NET code base over to ServiceStack.
The existing routes of the current codebase need a lot of rework so that they align with a new routing convention. But that work needs to be deferred to the future, once the port is done, and the new codebase is up and running with parity to old codebase.
In the meantime, I would like to define (in code) how the routes should be in the new convention, but support the old convention at runtime - so nothing changes.
My first thought was to define a new attribute to markup the old routes so tis obvious to a developer was is legacy and needs changing/removing. So we defined this:
[Route("/newroute", "POST")]
[LegacyRoute("/crappyoldroute", "POST")]
public class NewlyNamedRequest : IReturn<NewlyNamedResponse>
{
// some inbound data
}
Where [LegacyRouteAttribute]
derives from [RouteAttribute]
This would be best from a code maintenance perspective (ie calling out the thing that needs to change, so that developers can progressively make those changes both frontend and backend over time), but of course ServiceStack at runtime likely won’t find the LegacyRouteAttribute
by reflection when it is building its routing table. So my old routes will stop working.
Is there, by chance, some kind of mechanism I can plugin to extend the ServiceStack routing discovery mechanism that would help me here?