You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a unit test project to ensure that all of the routes used in my API client library can be resolved to actual endpoints in the API project.
To do that, I use the registered EndpointDataSource instance(s) to list the registered endpoints, TemplateParser / TemplateMatcher to match the path, HttpMethodMetadata to check the method, IRouteConstraint to match the parameters, and EndpointSelector to select the endpoint from the matching endpoints.
If I use app.UseEndpoints(e => { ... }) to configure the endpoints, then everything works as expected. But I get an ASP0014 warning telling me I should be using top-level route registrations.
Is this expected? Is the EndpointDataSource now obsolete with top-level route registrations? And if so, is there a replacement I can use to find a matching Endpoint given an HTTP method and route path?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I have a unit test project to ensure that all of the routes used in my API client library can be resolved to actual endpoints in the API project.
To do that, I use the registered
EndpointDataSourceinstance(s) to list the registered endpoints,TemplateParser/TemplateMatcherto match the path,HttpMethodMetadatato check the method,IRouteConstraintto match the parameters, andEndpointSelectorto select the endpoint from the matching endpoints.ApiRouteTester.cs
If I use
app.UseEndpoints(e => { ... })to configure the endpoints, then everything works as expected. But I get anASP0014warning telling me I should be using top-level route registrations.If I switch to using top-level route registrations, then the
EndpointDataSourceis completely empty.Is this expected? Is the
EndpointDataSourcenow obsolete with top-level route registrations? And if so, is there a replacement I can use to find a matchingEndpointgiven an HTTP method and route path?Beta Was this translation helpful? Give feedback.
All reactions