Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Commented Issue: Provide a convenience generic overload to MapHttpRoute which requires minimal params [160]

$
0
0
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.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>