Today if I register a specific route, I write code like this
routes.MapHttpRoute(
name: "Orders by category",
routeTemplate: "api/order/{category}",
defaults: new { controller = "OrdersByCategory" }
);
If I have many custom routes this gets very verbose. In most cases I never need the name. The controller is also often located in the same assembly where the registration is happening.
Proposal would be to add an overload with a generic param for the Controller that would let me write code like this
routes.MapHttpRoute<OrdersByCategoryController>("api/order/{category}")
In this case I have not specified the name, so one a unique name would be generated.
Comments: Attribute Routing is making this simpler now. You can add the RoutePrefix to your controller as an attribute.
routes.MapHttpRoute(
name: "Orders by category",
routeTemplate: "api/order/{category}",
defaults: new { controller = "OrdersByCategory" }
);
If I have many custom routes this gets very verbose. In most cases I never need the name. The controller is also often located in the same assembly where the registration is happening.
Proposal would be to add an overload with a generic param for the Controller that would let me write code like this
routes.MapHttpRoute<OrdersByCategoryController>("api/order/{category}")
In this case I have not specified the name, so one a unique name would be generated.
Comments: Attribute Routing is making this simpler now. You can add the RoutePrefix to your controller as an attribute.