December 2019
Intermediate to advanced
510 pages
11h 33m
English
The routing engine of ASP.NET Core also provides a way for us to create our routing attributes. This technique is useful in complex routing systems where it is essential to keep a conceptual order between different routes. An example of a custom routing definition is as follows:
using System;using Microsoft.AspNetCore.Mvc.Routing;namespace SampleAPI.CustomRouting{ public class CustomOrdersRoute : Attribute, IRouteTemplateProvider { public string Template => "api/orders"; public int? Order { get; set; } public string Name => "Orders_route"; }}
The class extends the Attribute abstract class, which is to be applied as an attribute. It implements IRouteTemplateProvider to get the attributes of the routing template workflow. ...
Read now
Unlock full access