Mar 17, 2012 at 8:05 AM
Edited Mar 17, 2012 at 8:07 AM
Here's how I would want it work
// should throw (or can return null) if container doesn't contain an instance matching the contract
var x = container.GetExportedValue<T>();
var y = container.GetButDoNotCreate<T>();
// should return the object created in previous step
The difference is that this method won't create an instance if the container doesn't contain it. It is a pure-get. It should work for both shared and non-shared parts.. (given some unique way of identifying an instance)
I need it for my tests where I do not want the test code to create objects in the production container (if they are not created) just use existing ones. Only production code should add/remove objects to the container.
Is this possible ?