Why use IKernel over IWindsorContainer?
Asked Answered
D

1

14

I have seen in several code examples where people have used IKernel rather than use IWindsorContainer. Why is this?

Here is one example: http://docs.castleproject.org/(S(kwaa14uzdj55gv55dzgf0vui))/Windsor.Windsor-tutorial-part-two-plugging-Windsor-in.ashx

In the above example it came to bite me because I added a subresolver

Container.Kernel.Resolver.AddSubResolver(
        new CollectionResolver(Container.Kernel, true));

that will allow me to inject collections... but yet it wasnt working. I figured out that because just the IKernel was being used it couldnt use the full features of Windsor. Why would someone ever want to use the Kernel over the full container? I think if you are going to implement Windsor, use the full container. Am I wrong? Why?

Dow answered 22/7, 2011 at 20:10 Comment(0)
C
20

There are historical reasons for that. Originally Castle project had two containers: MicroKernel (IKernel) which provided all the base functionality and extension points, and Windsor IWindsorContainer which was a wrapper around MicroKernel providing additional features (like XML configuration, proxies etc) and was wrapping the MicroKernel.

Those were later (in v2.5) merged into a single project/assembly but to avoid breaking existing users the distinction was kept.

Chrystalchryste answered 23/7, 2011 at 1:11 Comment(3)
Thanks for the history. So I would assume going forward if I say I am using Windsor, I dont really need to use IKernal unless I am using something that requires the old IKernel specifically?Dow
Is it still true that IKernel is automatically registered but IWindsorContainer is not?Flaxen
kind of. IKernel is available as a dependency OOTB, IWindsorContainer is not, as it is a user facing interfaceChrystalchryste

© 2022 - 2024 — McMap. All rights reserved.