Well, my final decision was to trick in ninject 2.0 with the following code ...
var windowFactory = kernel.Get<IEWindowFactory>(); var tabFactory = kernel.Get<IETabFactory>(); windowFactory.Kernel = kernel; tabFactory.Kernel = kernel;
and in the list of bindings
Bind<IEWindowFactory>().ToSelf().InSingletonScope(); Bind<IETabFactory>().ToSelf().InSingletonScope();
and after that I just run my application
var main = kernel.Get<MainForm>(); main.Start();
and, of course, factories are introduced where I need them, in the hierarchy of this MainForm.
therefore, I manually installed the kernel at startup, and then when I load my application, naturally, these factories are fields in classes with [Ninject] annotation, and therefore they can create objects. not the cleanest until we get 3.0, but it works (and I hate extra factory classes, I have to write code, but ok).
source share