I am learning MVC and 2 questions I often have and not found are:
I know route table is a class that maintains routing for MVC but how?
When is the route table actually created? We just register it at application startup.
I am learning MVC and 2 questions I often have and not found are:
I know route table is a class that maintains routing for MVC but how?
When is the route table actually created? We just register it at application startup.
The route table is populated ("created") at application startup. Although this collection technically can be modified after startup with MVC 5 and prior, this approach goes against the grain of dependency injection best practices.
Although the route table is static at runtime, the routes that populate the table can be made dynamic through route constraints or by subclassing RouteBase
in MVC 5 and below or implementing IRouter
in MVC Core.