views:

46

answers:

1

I have a single Ninject 2 Kernel for my application which contains all bindings. One section of the application needs to have different settings on the Kernel than the rest of the application, but needs the same bindings (that portion is for NHibernate and needs InjectNonPublic = true and the InjectAttribute set). How can a make a Kernel that shares bindings with the current kernel but has different settings?

I believe that in other IOC containers this is would be achieved with a "nested container", however I don't see any support for nested containers in Ninject?

+1  A: 

Have you tried the Ninject.Extensions.ChildKernel extension?

Martin Owen
Doesn't look like the ChildKernel extension will work. If the parent Kernel can resolve the binding it will be used. In my case, the parent can resolve the binding, but I want the child kernel's settings to be used. I think I actually figured out a way to do it. I'll post how soon.
Jeff Walker Code Ranger