'RouteBuilder vs EndpointRoutBuilder in .Net
I am trying to learn behind the scene of Routing and I find out that WebApplication
implements IEndpointRouteBuilder
which allows it to define routes for example using MapGet
or even the UseEndpoint
middleware itself use it behind the scene. I also see another type and interface which was very similar to that but not related in any way to it: RouteBuilder
. It also has methods starting with Map and seems that have same usage with IEndpointRouteBuilder
. Where is used RouteBuilder
in the routing in .Net 6 and does it is obsolete or it is used yet? What is the usage then which can not implemented by IEndpointRouteBuilder
? Thanks
Solution 1:[1]
It seems that before current approach of UseRouting() and UseEndpoints() the approach is to use UseRouter(IRouter router) middleware which get an IRouter argument which get from RouterBuilder. More information in following link: Routing in Asp.Net 2.1
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mehdi Mowlavi |