In our project, we use Unity as the basis for dependency injection. Now I am faced with a situation where I need a later version IUnityContainer.RegisterInstance().
In ninject, the code I'm trying to do will look something like this:
this.Bind<IMyInterface>().ToMethod(context => GetMyObjectLateBound());
In Unity, however, I have not yet found a way to do this.
The reason I need this is because by that time the instance IMyInterfacehas not yet been created, that the binding is in progress, and the creation of the object is also not processed by Unity (and I cannot replace it any time soon).
source
share