RequestDelegateFactory should take an optional set of route pattern names or route parameter names #33700
Labels
api-approved
API was approved in API review, it can be implemented
area-minimal
Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
feature-minimal-actions
Controller-like actions for endpoint routing
Projects
Milestone
Background and Motivation
This would allow unattributed methods to disambiguate between route and query string when the method parameters are unattributed. Today we generate code that prefers route over query string and we could avoid that in certain cases. It would also allow us to better fail if the user used
[FromRoute]
and there was no route parameter with that name defined.Proposed API
Since our overloads are getting a bit crazy with this change, I suggest we add an options object to handle the overflow.
Usage Examples
Alternative Designs
A single static method with optional parameters.
public static class RequestDelegateFactory { + public static RequestDelegate Create(MethodInfo methodInfo, Func<HttpContext, object>? targetFactory = null, IServiceProvider? serviceProvider = null, IReadOnlyList<string>? routeParameterNames = null); }
Risks
None
The text was updated successfully, but these errors were encountered: