StructureMap reset singleton instance

I created a loader that creates a singleton object. In some cases, I want the singleton to be recreated ... I tried: ObjectFactory.Model.For () EjectAndRemoveAll () ;.

Does anyone know how I can remove current instances for a specific type without deleting the rules that determine its creation. for example, ObjectFactory.EjectAllInstancesOf will also remove the configuration rules.

thanks for the help

+3
source share
1 answer

One way: Define the life cycle by overriding ILifeCycle , which pops the cached instance when your conditions are met.

singleton , , .

+1

Source: https://habr.com/ru/post/1758696/


All Articles