Ninject Clearing Out Resolved Instances
-
11-09-2019 - |
Question
I have some bindings that are setup as singletons. I want them to always return the same instance until a certain point at which I want all the singleton instances to be cleared. I don't want to remove and re-add the bindings, just clear out the instances that have been created. Is this possible?
Solution
Singletons are only single per kernel. You could just create a new kernel.
Alternatively, it seems that you don't really want singletons. How about using a class that contains the references you need.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow