Open hernangm opened 11 years ago
Hmm, nifty concept. Have you tried using a custom IRouteConstraintFactory? You can wire it up via config:
routes.MapAttributeRoutes(config => {
// ...
config.RouteConstraintFactory = new CustomRouteConstraintFactory();
});
It would be great if an extensibility point could be added so route constraints can be instantiated through a dependency injector such as Ninject. In many cases, I need to query a dbcontext to verify if the route matches (I can think of many other services that might be useful to have injected in the route constraint) and it would be ideal if the implementation of the service could be decoupled from its interface.