I want to use Unity resolve IService
to two different implementations, to make use of a wrapper class, the equivalent of:
IService service = new
I have found out that this is trivial to do in the Castle Windsor IoC container. Just register the classes in the right order - first the wrapper, then the wrapped class, and the right thing will happen.
e.g.
container.Kernel.AddComponent();
container.Kernel.AddComponent();
Not only is this a lot less fuss than in Unity, it preserves one of the key advantages of IoC - that if the parameters to the DispatcherService constructor change, no other code needs to change.
Let's hope that a future version of Unity steps up to make this scenario as simple as in Windsor.