Per Call Resolve by new() LifetimeManager

Jul 1, 2009 at 1:36 PM

I just realized that a call to Resolve for a Registred Type using the ExternallyControlledLifetimeManager returns the same Instance again and again, kind of singleton behaviour. This is fine because so stated in the documentation. However, I want Resolve to return a new Instance of the Registred Type whenever I call it. For me, this would be the standard behaviour. Is there a LifetimeManager around, waiting for me to download it?

What would be the approach, write a new LifetimeManager or find the right configuration? Thanks for any hint.

btw. I am using unity configuration based.


Jul 1, 2009 at 1:54 PM

By default, Unity creates a new instance everytime the Resolve method is called so the key is, do not specify a lifetime manager.


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.

Jul 2, 2009 at 6:03 AM
Edited Jul 2, 2009 at 6:03 AM

Thanks Sarah for the quick and astonishing answer! Less is More.