By using Microsoft’s Unity, I am able to override a dependency in the exact moment that I’m resolving an instance, for example:
var valueObjectThatOverridesAnyConfiguration = new object();
var container = new UnityContainer();
container.Resolve<ATypeWithConstructorArguments>(new DependencyOverride(typeof(object), valueObjectThatOverridesAnyPreviousConfiguration);
That will override any previous configuration on my UnityContainer and inject the instance I provided on the DependencyOverride.
Is there a way to specify it in a Container level ? Like an extension or something ? I don’t want to do it at the resolve moment!
Thanks! Let me know if I’m being confuse to you, I’ll provide more info.
Do you mean something like this. The part that sounds like your problem starts in the middle of the thread.
It allows you to do this
The sources can be found here inside the TecX.Unity project.