It is possible to set the "Routehandler" as a attributes on the controller class or the controller methods?
Like this
[RoutePrefix("api/cart")]
//[RouteHandler(new CustomRouteHandler())] ???????
public class CartController : ApiController
{
private readonly CartRepository _repository;
public CartController()
{
_repository = new CartRepository();
}
}
Or something like this
[HttpGet]
[Route(Name = "api/{controller}")]
//[RouteHandler(new CustomRouteHandler())] ?????
public Cart Hest()
{
return _repository.Get();
}
The only place i can seem to set the RouteHandler is in the config like this.
RouteTable.Routes.MapHttpRoute(
name: "test",
routeTemplate: "{controller}/{action}",
defaults: new { action = RouteParameter.Optional }
).RouteHandler = new CustomRouteHandler();
Any ideas?