Add support for endpoint filters in minimal APIs#40491
Merged
Merged
Conversation
davidfowl
reviewed
Mar 2, 2022
davidfowl
reviewed
Mar 2, 2022
davidfowl
reviewed
Mar 2, 2022
e3f3f50 to
5f6d1c5
Compare
davidfowl
reviewed
Mar 2, 2022
davidfowl
reviewed
Mar 2, 2022
pranavkm
reviewed
Mar 2, 2022
This was referenced Mar 2, 2022
pranavkm
approved these changes
Mar 3, 2022
davidfowl
approved these changes
Mar 3, 2022
d3e5db4 to
70fbdab
Compare
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
BrennanConroy
approved these changes
Mar 4, 2022
| /// <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. |
Member
There was a problem hiding this comment.
Next PR:
Suggested change
| /// 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) |
Member
There was a problem hiding this comment.
Don't see any tests using these methods, should add that in the next PR 😃
WeihanLi
reviewed
Mar 4, 2022
|
|
||
| namespace Microsoft.AspNetCore.Http; | ||
|
|
||
| internal class DelegateRouteHandlerFilter : IRouteHandlerFilter |
WeihanLi
reviewed
Mar 4, 2022
| /// <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) |
Contributor
There was a problem hiding this comment.
WithFilter may be better I think
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
MethodInfoassociated with the handlerRouteHandlerFilterContext.Parametersdefinition to provide details about the parameter type, name, and (possibly) validity