Reputation: 3255
I have created a bootstrapper which creates a singleton object. Under some circumstances, I wish to have the singleton recreated... I have tried: ObjectFactory.Model.For().EjectAndRemoveAll();
Does anyone know how I can remove current instances for a specific type, without removing the rules that govern its creation. e.g. ObjectFactory.EjectAllInstancesOf will remove the config rules as well.
thanks for your help
Upvotes: 3
Views: 1100
Reputation: 6019
One way would be to define a lifecycle by overriding ILifeCycle which ejects the cached instance when your conditions are met.
You could start by looking at the implementation of the singleton lifecycle in the structuremap source and perhaps inherit or modify that.
Upvotes: 1