-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for endpoint filters in minimal APIs #40491
Conversation
e3f3f50
to
5f6d1c5
Compare
d3e5db4
to
70fbdab
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/// <summary> | ||
/// A list of parameters provided in the current request to the filter. | ||
/// <remarks> | ||
/// This list is not read-only to premit modifying of existing parameters by filters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Next PR:
/// This list is not read-only to premit modifying of existing parameters by filters. | |
/// This list is not read-only to permit modifying of existing parameters by filters. |
/// <param name="builder">The <see cref="RouteHandlerBuilder"/>.</param> | ||
/// <param name="filter">The <see cref="IRouteHandlerFilter"/> to register.</param> | ||
/// <returns>A <see cref="RouteHandlerBuilder"/> that can be used to further customize the route handler.</returns> | ||
public static RouteHandlerBuilder AddFilter(this RouteHandlerBuilder builder, IRouteHandlerFilter filter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't see any tests using these methods, should add that in the next PR 😃
|
||
namespace Microsoft.AspNetCore.Http; | ||
|
||
internal class DelegateRouteHandlerFilter : IRouteHandlerFilter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to be sealed
/// <param name="builder">The <see cref="RouteHandlerBuilder"/>.</param> | ||
/// <param name="filter">The <see cref="IRouteHandlerFilter"/> to register.</param> | ||
/// <returns>A <see cref="RouteHandlerBuilder"/> that can be used to further customize the route handler.</returns> | ||
public static RouteHandlerBuilder AddFilter(this RouteHandlerBuilder builder, IRouteHandlerFilter filter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WithFilter
may be better I think
Resolves #37853.
This PR introduces an initial implementation of filters for route handlers in minimal APIs. As follow-ups to this work we want to be able to do the following:
MethodInfo
associated with the handlerRouteHandlerFilterContext.Parameters
definition to provide details about the parameter type, name, and (possibly) validity