Skip to content

Add APIs to make it possible for users of RouteEndpointBuilder to use filters #42592

@davidfowl

Description

@davidfowl

Background and Motivation

In .NET 7 preview 6 we made it possible to run RouteHandlerFilter (name TBD) on all endpoints. That implementation always wraps the RequestDelegate so that all RouteEndpoint(s) will execute filters. We need to make it possible for custom EndpointDataSource to get access to the filter list on the RouteEndpointBuilder.

Proposed API

namespace Microsoft.AspNetCore.Routing;

public static class RouteEndpointBuilder 
{
+    public List<Func<RouteHandlerContext, RouteHandlerFilterDelegate, RouteHandlerFilterDelegate>>? RouteHandlerFilterFactories { get; set; }
}

Usage Examples

It's non-trivial to show real usage. Generally these filters need to be composed around a delegate. For that, they need to be exposed.

Risks

None

Metadata

Metadata

Assignees

Labels

api-approvedAPI was approved in API review, it can be implementedold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions