托管可扩展性框架

发布于 2024-10-20 09:08:58 字数 128 浏览 5 评论 0原文

我正在为我的组织创建一项服务,该服务将安装在数百台计算机上。它的实施可能需要随着时间的推移而改变。在观看并阅读了一些有关 MEF 的内容后,我仍然有点迷失。如果我想将 dll 放入服务文件夹并让该服务获取更改,MEF 是否是一个好的解决方案?

I'm creating a Service for my organization that will be installed on hundreds of computers. The Implementation of it may need to change over time. After watching and read a bit about MEF I'm still a little lost. Is MEF a good soulution for say if I wanted to Drop a dll into the service folder and have that service pick up the changes?

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

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

发布评论

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

评论(5

我偏爱纯白色 2024-10-27 09:08:58

我已经用 MEF 做了很多工作。是的,MEF 会做您正在寻找的事情,但需要注意的是...

  • 可以在运行时发现并加载新的 DLL
  • 但是,它会加载到与主应用程序相同的应用程序域中,因此,
  • 如果不重新启动应用程序,您无法卸载或更改DLL。

如果最后一点是问题,请考虑MAF(尽管它要重得多)。但在 MAF 中,它会将您的扩展加载到单独的应用程序域中。

您的另一个选择只是生成另一个进程来处理请求,并将命令行参数传递给它。

I have done quite a bit with MEF. Yes, MEF will do what you're looking for, with a caveat...

  • You can discover and load in a new DLL at runtime
  • However, it loads into the same App domain as your main application so,
  • You can't unload or change the DLL without restarting your application

If that last point is a problem, consider MAF (although it's much heavier). But in MAF, it will load your extensions into a separate app domain.

Your other option is just to spawn off another process to handle the request, and pass command line parameters to it.

古镇旧梦 2024-10-27 09:08:58

如果您使用的是 VS2010,我建议您先尝试单击一次。它为您提供了 setup.exe,还为您提供了一个 HTML 文件(和其他文件),您可以将其上传到 IIS 服务器或 FTP 站点,甚至上传到本地网络上的共享文件夹。问题是,当您配置部署时,您可以告诉安装程序直接从站点(HTML 文件、ftp 或 lan 共享文件夹)自动更新所有客户端。当用户启动应用程序时,它将连接到该站点并请求更新(如果存在),如果存在,应用程序将自行更新。如果您想部署更新,只需再次上传 HTML 文件和文件夹中的所有其他文件。

查看此链接:

http://msdn.microsoft.com/en-us/ Library/ms953320.aspx

http://weblogs.asp.net/shahar/archive/2008/01/29/how-to-use-clickonce-to-deploy-your-applications.aspx

快乐编码;)

if you are using VS2010 i recommend you try first Click Once. It gives you the setup.exe but also gives you an HTML file (and other files), wich you can upload to an IIS server or an FTP site, or even to a shared folder over your local network. The thing is, when you configure your deployment you can tell the installer to auto-update all clientes directly from the site (the HTML file, ftp or lan shared folder). When user starts the application it will connect to the site and ask for an update if it exists, and if it does, the application will self-update. If you want to deploy an update, you only need to upload again the HTML file and all other files in the folder.

Check out this links:

http://msdn.microsoft.com/en-us/library/ms953320.aspx

http://weblogs.asp.net/shahar/archive/2008/01/29/how-to-use-clickonce-to-deploy-your-applications.aspx

Happy coding ;)

动听の歌 2024-10-27 09:08:58

我不是 MEF 方面的专家。文档称 Mef 致力于制作基于插件的系统。因此您的系统需要一些接口,并且 MEF 可以轻松地将实现这些接口的类导入到您的系统中。您的案例似乎适合于此。 MEF 具有目录目录,通过使用目录,您可以在运行时导入类型/dll。

如何获取 MEF 目录目录,查看 Servicelayer 和 DAL 的同一目录?

I am no expert about MEF. Documentation says Mef is all about making plug-in based systems. so your system expects some interfaces and MEF makes easy to import classes implemented these interfaces to your system.your case seems suitable for this. MEF has directory catalog and by using catalogs you can import types/dlls runtime.

How do I get a MEF Directory catalog looking at the same directory for both the Servicelayer and DAL?

断桥再见 2024-10-27 09:08:58

我认为,如果您将服务逻辑放在一个单独的类库中,并且在另一个类库中获得了所需的契约接口,那么您可以做到这一点。然后,您可以创建一个目录编目并使用 MEF 导入您的服务实现(您只需要引用契约接口程序集)。然后,如果发生更改,您可以选择新的 dll/服务实现。您只需要一个目录观察器(FileSystemWatcher),然后当目录观察器触发时,您必须调用目录的刷新方法。理论上它应该有效,但这只是一个想法。 :) 无论如何,希望这会有所帮助。

I think you can do this if you have your service logic in a separated class library and you got the needed contract interfaces in another class library. Then you can create a directory catalog and import your service implementation with MEF (you only need to reference to the contract interfaces assembly). Then you can pick up the new dll/service implementation if changed. You only need a directory watcher (FileSystemWatcher), then you have to call your catalog's refresh method when directory watcher fires. In theory it should work, but it's just an idea. :) Anyway, hope this helps.

秋千易 2024-10-27 09:08:58

您还可以查看 Prism。据我了解,它们是两个不同的框架,可以做几乎相同的事情。 Prism 允许您通过在 dll 中实现 IModule 接口的类来创建模块。您可以通过这种方式将 dll 拖放到文件夹中,就像在 MEF 中一样。您可以静态或动态加载模块,并执行许多我什至不知道的其他操作。

Prism 还捆绑了其他功能,即 Unity 依赖注入容器(我喜欢称之为“神奇的黑匣子”)、简洁的事件和命令系统等。我确信 MEF 也拥有所有这些功能。

You could also look into Prism. From what I understand, they are two different frameworks to do pretty much the same thing. Prism allows you to create modules by having a class in a dll that implements the IModule interface. You can just drag and drop dlls into a folder this way just like in MEF. You can statically or dynamically load modules, and do a bunch of other things I don't even know about.

Prism also has other features bundled with it, i.e. the Unity dependency injection container (which I like to call "The Magical Black Box"), a neat event and command system, etc. I'm sure MEF has all these things too.

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