Inverting Inversion of Control

time to read 1 min | 39 words

What do you think about this code?

IoC.Container.Kernel.AddComponentInstance<IFoo>(this);
IBar context = IoC.Resolve<IBar>();//needs IFoo

For some reason it looks really funny to me.

More seriously, this is a good way to involve components that you cannot control in the container.