实施插件/插件/插件策略的最佳实践

发布于 2024-09-10 23:54:26 字数 375 浏览 9 评论 0原文

我的应用程序应该是可扩展的。为了我自己的需要,我实施了一些服务。这些服务基于 IoC/DI 原则。因此,服务封装了应用程序的概念。

例如,有一个 IApplicationService。 ApplicationService 公开有关当前正在执行的应用程序的信息。指定了AssemblyInfo等。另一个示例是 INavigationService(请参阅示例中的 mef.codeplexcom)。此服务提供一些属性,其中包含有关指定的当前所选项目以及一些事件的信息。

我认为,“服务方法”是最简单的,并且简化了应用程序的扩展点。所以,我不确定这真的是最好的方法。你怎么认为?如何在诸如插件/插件/插件之类的应用程序中实现“扩展点”...?

预先感谢您的回复!抱歉,我的英语很差。 ;)

My application should be extensible. For my own needs I have implement some services. These services are based on the IoC/DI princple. So the services encapsulate the concept of the application.

For exsample, there are an IApplicationService. The ApplicationService exposes information about the current exceuting application. There are specified the AssemblyInfo and so forth. An other exsample is the INavigationService(see mef.codeplexcom in the samples). This services provides some properties where are information about the current selected item specified and also some events.

I think, that the "service approach" is the easiest and simplifies the extension points for the application. So, I am not sure that this is really the best approach. What do you think? How do you would implement "extensions points" in an application like addins/addons/plugins ... ?

Thanks in advance for your replies! And sorry, my english is poor. ;)

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

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

发布评论

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

评论(3

素染倾城色 2024-09-17 23:54:26

您熟悉MEF(托管可扩展性框架)吗?

托管扩展性框架(简称 MEF)简化了可扩展应用程序的创建。 MEF 提供发现和组合功能,您可以利用这些功能来加载应用程序扩展。

Are you familiar with MEF (Managed Extensibility Framework)?

The Managed Extensibility Framework (or MEF for short) simplifies the creation of extensible applications. MEF offers discovery and composition capabilities that you can leverage to load application extensions.

只为一人 2024-09-17 23:54:26

您确实需要查看 MEF - 托管可扩展性框架。

这是一个很棒的新框架,Microsoft 自己在 Visual Studio 2010 等中使用它来实现其可扩展性。很棒且易于使用 - 当您可以使用成千上万的开发人员很快就会使用的东西时,为什么要重新发明轮子呢?

You seriously need to look at MEF - the Managed Extensibility Framework.

It's a great new framework that Microsoft itself is using in e.g. Visual Studio 2010 for its extensibility story. Great and easy to use - why reinvent the wheel when you can use something that thousands of dev will use shortly??

娇俏 2024-09-17 23:54:26

是的,我很熟悉 MEF。我也使用MEF的概念,但有一些缺点。我的应用程序类似于 IoC/DI,并且与 MEF 一起使用有点复杂。 MEF 并不是真正的 DI 容器,因此将 MEF 与其他 DI 容器(例如 ninject、unity 等)一起使用很难实现这一点。我不会将 MEF 与其他 DI 容器一起使用。因此将 MEF 与其他 DI 容器混合并不是很好。

我希望你能理解我的担忧。

添加:无法将扩展加载到 MEF 中的 AppDomain 中。所以这对于我的需求来说并不好。 System.AddIn或MAF支持这个,但我不会使用System.AddIn,因为这个很重...。

Yes, I am familiar with MEF. I also use the concept of MEF, but there some disadvantages. My application is IoC/DI like and together with MEF is a bit complicated. MEF is not really a DI container so to use MEF with an other DI container(e.g. ninject, unity, ...) is difficult to implment this. I won't to use MEF with other DI containers. So to mix MEF with other DI containers is not really good.

I hope you can understand my concern.

Addition: It is not possible to load extensions in to an AppDomain in MEF. So this is for my needs not good. System.AddIn or MAF supports this, but I won't use System.AddIn, because this is very heavy ... .

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