Which bootstraper for Caliburn Micro
I would like to hear what bootstrapper (MEF, Unity, Autofac...etc) is suitable (the best) for caliburn micro by your opinion and why?
If you have some favorite, you can post code of this bootstrapper with how to use it on VM class or external assembly. I would be glad for it.
I am newbie in this domain; sorry if my question is little stup开发者_如何学JAVAid.
Thank for every opinion, advice and code example.
There is no best solution, it will depend on your applications design. MEF isn't a general purpose IoC container (unlike Unity, Autofac etc), and its focus is on the discoverability of types and their composition.
It is suitable for composite applications where extensions can be discovered at runtime and integrated into the application's shell. Its strength is in the fact that supporting assemblies can be dropped into a specified folder and be picked up without any additional work.
Unity etc are more general purpose and provide capabilities beyond MEF and in addition to object composition are also focused towards other dimensions of DI such as lifetime management and interception.
There's nothing to stop you using both MEF for supporting extensions/plugins, and a more general purpose IoC container such as Unity/Autofac/Castle Windsor for your applications general DI infrastructure.
If you're new to DI, then perhaps stick with MEF for the time being as it will offer all of the object composition features you will require, and Rob has already provided an implementation of the Bootstrapper which uses MEF.
Or you may wish to use MEF for an add-in architecture but use a proper IoC framework such as AutoFac for you dependency injection.
精彩评论