ASP.NET Core provides a lightweight, completely configurable Routing mechanism in the form of middleware, Convention-based routing, direct or Attribute Routing, constraints, and so on. Proper usage of these routing features is necessary for optimal performance of the application.
Some of the best practices that need to be considered are summarized next; these practices will evolve as more applications are built with various use cases. These lists may or may not apply to your application depending on your application's needs:
- Use the inbuilt UseMvc middleware which sits on top of the Routing middleware for achieving Routing strategy.
- Conventional routing is sufficient a CRUD style of web API is being developed. It reduces the overhead of writing direct routes for all the actions in various controllers.
- Try avoiding the catch-all route parameters, that...