Wednesday, June 13, 2018

convention-based routing versus attribute-based routing in MVC

Some of the history is touched on on page 91 of "ASP.NET Core 2 and Angular 5" by Valerio De Sanctis. Convention-based routing is the old approach in which a few global rules are specified in Global.asax and maybe there is a distinction between the regular controllers and the API controllers insofar as the API controller have "api" as the first hunk of the route. Attribute-based routing will have you decorating actions (methods inside a controller) with attributes to define their routes and is new as of MVC5. MVC6 which is ASP.NET Core MVC and a complete rewrite of MVC has it too.

No comments:

Post a Comment