ASP.NET Core | Attribute based routing
Attribute Routing gives you more control over the URIs in your web application. MVC 5 supports this attribute based routing where attributes are used to define the routes. You can manage resource hierarchies in better way using attribute based routing. Attribute based routing is used to create routes which are difficult to create using convention-based routing. For example below routes.
[Route("customers/{customerId}/orders")] public IEnumerableGetOrdersByCustomer(int customerId) { ... } . . . [Route("customers/{customerId}/orders/orderId")] public IEnumerable GetOrdersByCustomer(int customerId, int orderId) { ... }
Comments
Post a Comment