Caliburn Micro 的哪个引导程序
我想听听您认为哪种引导程序(MEF、Unity、Autofac...等)适合(最好)用于 caliburn micro,为什么?
如果您有喜欢的内容,您可以发布此引导程序的代码以及如何在 VM 类或外部程序集中使用它。我会很高兴的。
我是这个领域的新手;抱歉,如果我的问题有点愚蠢。
感谢您的每一个意见、建议和代码示例。
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 stupid.
Thank for every opinion, advice and code example.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
没有最好的解决方案,这取决于您的应用程序设计。 MEF 不是通用 IoC 容器(与 Unity、Autofac 等不同),它的重点是类型及其组合的可发现性。
它适用于复合应用程序,可以在运行时发现扩展并将其集成到应用程序的 shell 中。它的优点在于,支持组件可以放入指定的文件夹中,无需任何额外的工作即可拾取。
Unity 等更通用,提供超出 MEF 的功能,除了对象组合之外,还专注于 DI 的其他维度,例如生命周期管理和拦截。
没有什么可以阻止您使用 MEF 来支持扩展/插件,并使用更通用的 IoC 容器(例如 Unity/Autofac/Castle Windsor)来支持您的应用程序通用 DI 基础设施。
如果您是 DI 新手,那么也许暂时坚持使用 MEF,因为它将提供您需要的所有对象组合功能,并且 Rob 已经提供了使用 MEF 的 Bootstrapper 实现。
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.
或者您可能希望将 MEF 用于插件架构,但使用适当的 IoC 框架(例如 AutoFac)进行依赖项注入。
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.