Explain Route , Route colllection, MVCRouteHandler , Route Handler

 What is a Route

•  The Route is similar to a roadmap. We use a roadmap to go to our destination. Similarly, the ASP.NET Core Apps use the Route to go to the controller action.

• Each Route contains a Name, URL Pattern (Template), Defaults, and Constraints. The URL Pattern is compared to the incoming URLs for a match. An example of URL Pattern is {controller=Home}/{action=Index}/{id?}

• The Route is defined in Microsoft.AspNetCore.routing namespace.


Route Collection

  • The Route Collection is the collection of all the Routes in the Application.
  • An app maintains a single in-memory collection of Routes. The Routes are added to this collection when the application starts.
  • The Routing Module looks for a Route that matches the incoming request URL on each available Route in the Route collection.
  • The Route Collection Microsoft.AspNetcore.routing. is defined in the namespace


What is a Route Handler

  • The Route Handler is the Component that decides what to do with the route.
  • When the routing Engine locates the Route for an incoming request, it invokes the associated Route Handler and passes the Route for further processing. The Route handler is the class that implements the IRoute Handler interface.
  • In the ASP.NET Core, the Routes are handled by the MvcRouteHandler.


MVCRouteHandler

  • Default Route Handler for the ASP.NET Core MVC Middleware. The MVCRouteHandler is registered when we register the MVC Middleware in the Request Pipeline. 
  • You can override this and create your own implementation of the Route Handler. defined in the namespace Microsoft.AspnetCore. MVC.
  • The MVCRouteHandler is responsible for invoking the Controller Factory, which in turn creates the instance of the Controller associated with the Route.
  • The Controller then takes over and invokes the Action method to generate the View and Complete the Request.



Comments

Popular posts from this blog

What are different steps used in JDBC? Write down a small program showing all steps.

Discuss classification or taxonomy of virtualization at different levels.

Pure Versus Partial EC