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

Reusable filters should not use transient DI #103

Open
iojancode opened this issue Nov 20, 2022 · 0 comments
Open

Reusable filters should not use transient DI #103

iojancode opened this issue Nov 20, 2022 · 0 comments

Comments

@iojancode
Copy link

iojancode commented Nov 20, 2022

Hi, according to https://learn.microsoft.com/en-us/aspnet/core/mvc/controllers/filters

Only configure IFilterFactory.IsReusable to return true if the source of the filters is unambiguous, the filters are stateless, and the filters are safe to use across multiple HTTP requests. For instance, don't return filters from DI that are registered as scoped or transient if IFilterFactory.IsReusable returns true

Checking your code at RecaptchaServiceCollection.cs RecaptchaService its added as Transient, then at ValidateRecaptchaAttribute.cs you code property as IsReusable => true

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

1 participant