ninject/Ninject.Web.Mvc

You can't inject attributes

fsoikin opened this issue · 1 comments

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.

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.