.NET 插件...去哪里
我正在编写一个 Windows 应用程序,它通过 API 连接到网上商店并读取/写入值。
网上商店可以有多个支付网关,我正在考虑为每个网关编写一个插件,并创建一个用户界面,可用于选择每个网关并加载正确的程序集......
我的想法是有多个库 (.dll),并在设置后加载正确的库...
我确实认为这是 80 年代末的开发,所以我想知道是否有任何新的东西可以帮助我开发这样的库.NET 3.5 SP1 上的行为
我对此事不熟悉,为此我想问您解决此问题的最佳方法是什么。
谢谢。
PS 我读到了MEF (托管扩展性框架 )但它仍然是预览版(MEF Preview 8 是当前版本),并且只能在 .NET 4.0 上使用,所以我不能那样做:-(
I'm writing a Windows Application that connects to a webshop through it's API and reads/writes values.
The Webshop can have multiple Payment gateways and I was thinking about writing a plugin to each one and create a user interface that will be available to select each one and load the correct assembly...
my idea is to have multiple Libraries (.dll) and load the correct one once set up...
I do think this is kind'a late 80's developing so I wonder if there is anything new that could help me develop such behavior on .NET 3.5 SP1
I'm new to this matter, and for that I would ask you what is the best way to approach this.
Thank you.
P.S. I read about MEF (Managed Extensibility Framework) but it's still preview (MEF Preview 8 is the current), and only be available on .NET 4.0 so I can't go that way :-(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看 MEF 和 Unity,它们是来自 Microsoft 的两个非常有用的项目,应该有助于提高应用程序的可扩展性(MEF 实际上在 VS2010 内部使用来支持扩展)。
Take a look at MEF and Unity, they are two very useful projects from Microsoft that should help with extensibility in your app (MEF is actually used inside VS2010 to support extensions).
系统中的 .NET 3.5 添加了许多帮助程序类。 Addin 命名空间。这些有助于解决大量样板代码和此类开发的更困难的方面(例如在启动和运行时加载和删除插件以及代码隔离),但它们仍然遵循您已经了解的基本模式描述的。
我个人没有在现实世界的代码中使用过它们,但我已经把它们弄乱了,乍一看它们似乎工作得很好。
可以在此处找到概述。
There are a number of helper classes added into .NET 3.5 in the System.Addin namespace. These help out with a lot of the boiler plate code and more difficult aspects of this kind of development (such as loading and removing plugins at both startup and runtime as well as code isolation), but they still follow the basic pattern that you've described.
I haven't personally used them in real world code, but I have had a mess around with them and they appear at first glance to work well enough.
An overview can be found here.