Skip to content
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 registering an endpoint filter using an endpoint filter factory #323

Closed
ergonzalez-boh opened this issue Jul 10, 2023 · 2 comments

Comments

@ergonzalez-boh
Copy link

ergonzalez-boh commented Jul 10, 2023

Currently, Carter provides the ability to register endpoint filters through the CarterModule Before and After delegates. However, there is no built-in mechanism to incorporate an EndpointFilterFactory that would allow dynamic determination of whether an endpoint filter should be added to a specific endpoint during startup.

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/minimal-apis/min-api-filters?view=aspnetcore-7.0#register-a-filter-using-an-endpoint-filter-factory

@leandrods
Copy link

Hello @ergonzalez-boh

RouteGroupBuilder root = app.MapGroup("/api");
root.MapCarter();
root.AddEndpointFilterFactory(ValidationFilter.ValidationFilterFactory);

Can't you solve it with that?

@jchannon
Copy link
Member

Closing - as of .NET6 you should be using ICarterModule not CarterModule and you can use the EndpointFilterFactory stuff directly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants