As the name suggests, this uses attributes to route. This gives the user more control over the URI's in the WebAPI. For example, you can describe hierarchies of the resource. However, the earlier 'Conventional Routing' is fully supported. Users can have a mixture of both too.
Parameter Name | Details |
---|---|
RoutePrefix | attribute to the controller class. all common url prefixes in actions are clubbed here. takes string as input |
Route | attribute to the controller actions. each action will have route assosciated with(not necessarily) |
Route("~/api/") | this overrides the Route Prefix |
Currently, Attribute Routes doesn't have Controller specific Message Handlers. As there is no way to specify Which handler to execute for which route at the time of declaration. This is possible in Conventional Routing.