托管扩展性框架 (MEF) 与复合 UI 应用程序块 (CAB)

发布于 2024-07-20 23:36:50 字数 240 浏览 6 评论 0原文

我们目前正在考虑在下一个应用程序中使用 CAB 或 MEF。 我没有在 Codeplex 上看到任何有关如何处理同级控制通信的事件代理的示例,也许我错过了。 MEF 中的控制间通信如何工作?

此外,我们计划使用 Infragistics,它为 CAB 框架提供了额外的组件。 Infragistics 控件与 MEF 的集成效果如何?

总的来说,MEF 值得追求一个相当大的、15,000 小时的严格开发、应用吗?

We are currently looking at either using CAB or MEF for our next application. I didn't see any examples on codeplex of how event brokering is handled for sibling control communication, maybe I missed it. How does inter-control communication work in MEF?

Also, we are planning on using Infragistics which has provided additional components for the CAB framework. How well will Infragistics controls integrate into MEF?

Overall, is MEF worth pursuing for a decently large, 15,000 hours of strictly development, application?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

看透却不说透 2024-07-27 23:36:50

我可能是错的,但我不认为 MEF 有任何事件代理。 它是一个类似于 ioc 容器的通用组合引擎,但旨在提供更通用的插件和应用程序可扩展性解决方案。 另一方面,CAB 和 Prism 是 UI 框架,允许由 UI 组件组成的复合应用程序。 由于 UI 组件很可能需要相互通信并响应其他 UI 组件中的活动,因此底层框架需要提供一种用于 UI 组件之间的事件处理(发布/订阅)的机制。

I may be wrong but I don't think that MEF has any event brokering. It is a general composition engine similar to ioc containers but intended for a more general plug-in and application extensibility solution. CAB and Prism on the other hand are UI frameworks that allow composite applications that're made up of UI components. Since UI components will most likely need to communicate with each other and respond to activities in other UI components, the underlying framework needs to provide a mechanism for eventing (pub/sub) between UI components.

夜吻♂芭芘 2024-07-27 23:36:50

如果您将 MEF 与 WPF 和 MVVM 模式一起使用,那么您的部件通常会导出 ViewModel 类和 View 类(例如 DataTemplates 等)。 您的视图绑定到 ViewModel 并使用依赖属性和命令来来回通信。 因此,如果 A 部分需要与 B 部分进行通信,那么 A 部分可以导入对 B 部分的 ViewModel 的引用,并且它们可以来回进行方法调用。 A 部分还可以为 B 部分的事件等注册事件处理程序。

If you are using MEF with WPF and the MVVM pattern, then your parts typically export ViewModel classes and View classes (e.g. DataTemplates, etc.). Your View binds to the ViewModel and uses dependency properties and commands to communicate back and forth. Therefore, if Part A needs to communicate with Part B, then Part A can Import a reference to Part B's ViewModel and they can make method calls back and forth. Part A can also register event handlers for Part B's events, etc.

尾戒 2024-07-27 23:36:50

MEF 不包括事件机制,但是您可以将 Prism 的事件聚合器与 MEF 结合使用。 我在这里发表了一篇关于此的文章。

http://codebetter.com/blogs/glenn.block/archive/2009/02/23/event-aggregation-with-mef-with-and-without-eventaggregator.aspx

它的工作方式是您基本上导出 Prism 的复合事件类。

华泰
格伦

MEF does not include an eventing mechanism, however you can use Prism's event aggregator with MEF. I did a post on this here.

http://codebetter.com/blogs/glenn.block/archive/2009/02/23/event-aggregation-with-mef-with-and-without-eventaggregator.aspx

The way it works is you basically export Prism's composite event classes.

HTH
Glenn

原野 2024-07-27 23:36:50

我同意斯科特的观点。 “通用”的 pub/sub 模型似乎很有趣,但我很少需要它。 如果我想要一个解耦的消息,使用 MEF,我只需定义一个契约 IMessage,然后导出一个实现,然后在我需要的地方导入。 如果它是强类型消息,我将导入我需要交谈的确切部分并直接向其发送消息。

I concur with Scott. The "generic" pub/sub model seems interesting but seldom have I had a need for it. If I want a decoupled message, with MEF I simply define a contract IMessage and then export an implementation, then import wherever I need it. If it's a strongly-typed message, I'll import the exact part I need to speak with and directly message it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文