[API Review]: Add support for endpoint filters in minimal APIs #40506
Labels
api-approved
API was approved in API review, it can be implemented
enhancement
This issue represents an ask for new feature or an enhancement to an existing one
old-area-web-frameworks-do-not-use
*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Priority:1
Work that is critical for the release, but we could probably ship without
Milestone
Uh oh!
There was an error while loading. Please reload this page.
The implementation for this feature exists in #40491.
We add a new
IRouteHandlerFilter
interface that users will implement when writing their own filters.The
RouteHandlerFilterContext
captures theHttpContext
and the list of parameters provided to a route handler for access in the filter.Note: we want to users to be able to modify the existing parameters that are provided to the handler in their filters which is why the
Parameters
property is typed asIList
andIReadOnlyList
. AlthoughIReadOnlyList
has the benefit of limiting additions/removals from the list, it also prohibits mutations of existing items (e.g.CS0200
galore). However, we anticipate that we will make an incremental improvement toParameters
and type it as a variadic generic object that provides information about the type, parameter name, and validity of a parameter so the question ofIList
vsIReadOnlyList
is minute at the moment.We add a new
RouteHandlerFilters
field toRequestDelegateFactoryOptions
that can be used to pass the list of filters registered on a handler to the code-gen in theRequestDelegateFactory
.We add a collection of new extension methods that users can invoke on their endpoints to register handlers.
Code Sample
The text was updated successfully, but these errors were encountered: