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

You can't inject attributes #31

Closed
fsoikin opened this issue Sep 17, 2013 · 1 comment
Closed

You can't inject attributes #31

fsoikin opened this issue Sep 17, 2013 · 1 comment

Comments

@fsoikin
Copy link

fsoikin commented Sep 17, 2013

NinjectFilterAttributeFilterProvider is nonsense: you cannot inject dependencies into attributes.
There is exactly one instance of attribute per attribute application per appdomain, which means you will inject dependencies into the same instance over and over again, on every request.

This is fine when those dependencies are globally scoped, but not so fine when they are, say, request-scoped, which is a very common case. Even less fine if you happen to handle multiple requests at the same time, which is not just common case - it's the ONLY case. And in that case, you get yourself weird race conditions.

@remogloor
Copy link
Member

Not a bug. Just because you are using filterinjection the wrong way doesn't means it makes sense to support it.

Filters of any kind are shared by several requests. This means you are not allowed to have any dependency to a shorter living dependency. If you need shorter living dependencies then you have to create them during evaluation of the filter using a factory.

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

2 participants