Using StructureMap, how do you explicitly trigger the reinstantiation of a object with InstanceScope

Posted by Mark Rogers on Stack Overflow See other posts from Stack Overflow or by Mark Rogers
Published on 2010-06-07T01:29:27Z Indexed on 2010/06/07 1:32 UTC
Read the original article Hit count: 336

I have an integration test harness where I want to teardown and then re-instantiate some of the singleton-scoped objects I've registered with StructureMap, after and before each test.

This way I can simulate the actual run time environment, but not have the singleton's state being passed from one test to another. Maybe this isn't a great way to do an integration test, but I'm running out of alternative solutions (read open to any advice).

So can an object with InstanceScope.Singleton, be re-instantiated?

What's the best way to do re-instantiate a singleton-scoped object with StructureMap?

© Stack Overflow or respective owner

Related posts about dependency-injection

Related posts about structuremap