.NET 应用程序的插件设计

发布于 2024-07-04 00:35:16 字数 517 浏览 14 评论 0原文

我正在考虑用 C# 重写我们的应用程序的一部分(当前是旧版 VB6 代码)。 我开始使用的模块负责将数据从各种系统导入到我们的数据库中。 每年大约有 5-6 次,新客户要求我们为他们使用的系统编写新的导入。 目前,这要求我们为添加到应用程序的每个新导入选项发布新版本的软件。

重写的目标之一是使应用程序支持插件。 每个新的导入都可以成为一个单独的程序集,主机应用程序将识别该程序集并允许最终用户与之交互。 这有望在某种程度上简化生活,因为我们可以简单地将新程序集放入目录中,并让它被主(主机)应用程序识别和使用。

我正在努力解决的问题之一与我们当前支持的导入选项之间的差异有关。 在某些情况下,我们实际上让用户指向一个目录并将该目录中的所有文件读取到我们的系统中。 在其他情况下,我们允许它们指向单个文件并导入其内容。 此外,某些导入具有用户应用的日期范围限制,而其他导入则没有。

我的问题是,如何设计应用程序,使我们构建和支持的导入具有一定的灵活性,同时实现一个通用接口,使主机应用程序能够轻松识别插件和选项每个都向用户公开?

I’m looking at rewriting a portion of our application in C# (currently legacy VB6 code). The module I am starting with is responsible for importing data from a variety of systems into our database. About 5-6 times a year, a new client asks us to write a new import for the system that they use. Presently, this requires us to release a new version of our software for each new import option we add to the application.

One of the goals of the rewrite is to make the application support plug-ins. Every new import can become a separate assembly which the host application will recognize and allow the end user to interact with. This will hopefully simplify life to some degree as we can simply drop a new assembly into the directory and have it be recognized and used by the main (host) application.

One of the items I am struggling with relates to the differences between the import options we currently support. In some cases we actually let the user point to a directory and read all of the files within the directory into our system. In other cases we allow them to point to a single file and import its contents. Additionally, some imports have a date range restriction that the user applies while others do not.

My question is, how can I design the application in a manner that allows for some flexibility among the imports we build and support while at the same time implementing a common interface that will allow the host application to easily recognize the plug-ins and the options that each one exposes to the user?

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

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

发布评论

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

评论(3

只有一腔孤勇 2024-07-11 00:35:16

有关理论,请查看 martin fowlers 企业应用程序架构模式中的插件模式

有关有趣的示例,请查看本教程:使用 C# 的插件架构

for the theory take a look at the plugin pattern in martin fowlers Patterns of Enterprise Application Architecture

for an interesting example take a look at this tutorial: Plugin Architecture using C#

赴月观长安 2024-07-11 00:35:16

.Net 3.5具有system.Addin命名空间。

该线程还提供了一些有关旧版本框架的好信息:
http://forums.devshed.com/net-development -87/system-plugin-532149.html

.Net 3.5 has the system.Addin namespace.

This thread also has some good information for older versions of the framework:
http://forums.devshed.com/net-development-87/system-plugin-532149.html

且行且努力 2024-07-11 00:35:16

我建议您查看 .NET 3.5 附带的托管加载项框架。 加载项团队已在 CodePlex 网站 以及..

I would recommend you take a look at the Managed Add-In Framework that shipped with .NET 3.5. The Add-In team has posted some samples and tools at CodePlex site as well..

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