MEF 是否应该在生产应用程序中使用
我目前需要提供一种在我的应用程序中添加可扩展性的方法。我目前正在研究 MEF 和 MAF。
MEF 提供了更简单的编程模型,也更适合我们的使用场景,因为我们只想将插件加载到单个 AppDomain 中 - 这是由于系统的架构方式所致。使用 MAF 也可以通过几行代码实现同样的事情。
但是,我想知道鉴于 MEF 的预览状态,是否应该在生产系统中使用 MEF?
I currently need to provide a means of adding extensibility in my application. I'm currently looking at MEF and MAF.
MEF provides a simpler programming model, and also fits our usage scenarios better as we only want to load addins into a single AppDomain - this is due to the way the system has been architected. The same thing can be achieved with MAF with few lines of code too.
However, I was wondering if MEF should be used in production systems, given it's preview status?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我目前正在编写一个基于 MEF 的“真实”应用程序。我的第一步是构建一个通用的可扩展应用程序框架(具有可扩展的菜单、工具栏、状态栏、可停靠窗口等)。我们将其开源为 SoapBox Core。我还发布了一个 演示 解释其工作原理。
我当然认为它已经可以在实际应用中使用了。
I am currently writing a "real" application based on MEF. My first step was to build a generic extensible application framework (with extensible menus, toolbars, status bar, dockable windows, etc.). We open sourced that as SoapBox Core. I also posted a demo explaining how it works.
I certainly think it's ready to use in real applications.
我认为您不需要担心MEF的新版本或变化。 MEF 是一个库程序集。在生产应用程序中,您可以将 MEF 库添加到项目中,并始终将程序集复制到本地部署目标。这样,您的生产应用程序将保留该版本。
我使用过很多开源库。只要您的库文件位于部署应用程序的同一文件夹中,就可以了。最好获取原始开源项目的源代码或将它们添加到您的解决方案中。如果您需要调试到库中,它将为您提供帮助。
I think that you should not need to worry about the new version or changes of MEF. MEF is a library assembly. In your production application, you can add MEF library to your project and always copy the assembly to your local deployment destination. In this way, you production application will stay with that version.
I have used many open source libraries. As long as you have the library files in the same folder where your application is deployed, you will be OK. It is better to get the source codes of the original open source projects or add them to your solution. It will help you if you need to debug into the library.
MEF 已经经历了多次迭代,我认为它现在已经非常接近稳定的 API(也许与Silverlight 支持除外)。请记住,MEF 将成为 .NET 4.0 的一部分,并且 VS2010 预计将使用 MEF 作为其可扩展性模型,因此在这个后期阶段大幅更改 API 的动力非常有限。
FWIW,我对 MEF 的稳定性没有任何问题,并且在生产系统中使用它也不会出现问题。只需像对待任何其他开源组件一样谨慎对待它即可。
MEF has been through several iterations, and I think it is pretty close to a stable API now (maybe with the exception of its Silverlight support). Remember that MEF will be part of .NET 4.0 and VS2010 is slated to use MEF for its extensibility model, so there is strong disincentive to change the API dramatically at this late stage.
FWIW, I haven't had any problems with the stability of MEF, and wouldn't see an issue using it in a production system. Just treat it with the same caution that you would any other open source component.