Search code examples
ninjectmefcaliburn.micro

Caliburn.Micro HelloScreens sample - using Ninject as IOC container


Love the Caliburn.Micro HelloScreens example, but am getting stuck with MEFs Dependency Injection. I would prefer to use Ninject as I am most familiar with it. Have read some great articles on hosting MEF in an IOC container (http://blogs.msdn.com/b/nblumhardt/archive/2009/03/16/hosting-mef-extensions-in-an-ioc-container.aspx)...but cannot get a simple example working with caliburn.micro.

What I'm looking for is a way to use Ninject Constructor Injection along side MEF. MEF for extension management. Ninject for constructor dependency injection.

I'm looking for a working Caliburn.Micro bootstrapper that incorporates MEF and Ninject?


Solution

  • I'm looking for a working Caliburn.Micro bootstrapper that incorporates MEF and Ninject?

    I have been using Caliburn.Micro for a long time now and I have came across every sample on the internet that uses it, and there is no such sample.

    Now I will recommend another thing, using two containers in your application at the same time is pretty tricky as pointed to by the article as well.

    So if I were you I would either use MEF which handles a lot of dependency injection tasks although it is not a DI container and of course it supports extension.

    On the other hand, if you really like Ninject and use it a lot then you should take advantage of Ninject features, two which are very good for supporting extensions or add-ins which are Conventions Extension or Ninject Modules, you can read more about those two features in this stackoverflow question.