Comments (1)
Thank you for this request. I updated the documentation to make it more clear. The documentation now states:
Web API caches filter attribute instances indefinitely per action, effectively making them singletons. This makes them unsuited for dependency injection, since the attribute's dependencies will be accidentally promoted to singleton as well, which can cause all sorts of concurrency issues. This problem is commonly referred to as Captive Dependencies and although Simple Injector tries to find those issues, it will be unable to do so in this this case.
...
Reverting to Service Locator means that you need to do the following:
- Extract all the attribute's logic -with its dependencies- into a new service class.
- Resolve this service from within the filter attribute's
OnActionExecXXX
methods, but don't store the resolved service in a private field.- Resolve this service from within the filter attribute's
OnActionExecXXX
methods (but prevent storing the resolved service in a private field as that could lead to undetectable Captive Dependencies).- Call the service's method.
I hope it makes more sense now.
from documentation.
Related Issues (20)
- There is a way to share Singletons registrations between two containers? HOT 2
- Describe how to load ASP.NET Core Controllers and ViewComponents from different assemblies HOT 2
- Add documentation for ScopedLifestyle.Flowing to lifestyle docs
- Add example about parallel processing of work in the context of scoped dependencies HOT 1
- Example extension method not compiling in the docs of Diagnostic Warning - Disposable Transient Components HOT 2
- Decoration example with DeadlockRetry & Validation HOT 3
- Why do the SqlUserRepository class code have constructor called UserController? HOT 1
- Add example for the new ASP.NET Core 6.0 "startup-less" configuration to ASP.NET Core MVC Integration NuGet package integration docs HOT 3
- "Register.Collection" instead of "Collection.Register" HOT 2
- WPF: How do I compose UI elements via DI? HOT 2
- Add information on ASP.NET Core integration page about missing [FromService] integration HOT 1
- Add context-based example that uses ctor argument names
- Add context-based example that uses ctor argument names HOT 1
- Add context-based example that uses parent's parent type
- Documentation typo HOT 2
- IOptions commentary HOT 3
- Update copyright
- Windows form how to call forms correctly from container HOT 5
- Add information about the design decision to not support optional constructor dependencies
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from documentation.