MEF 容器使用目录目录自动更新

发布于 2024-10-06 10:53:36 字数 202 浏览 0 评论 0原文

如果我们手动创建一个 FileSystemWatcher 并观察“parts”目录(这里是文件夹内的一些 dll)并跟踪任何更改,然后我们将更改反映到允许重新组合的容器中,这是可能的。

Container 使用 DirectoryCatalog 时,MEF 是否支持自动更新并自动为我们服务?

This is possible if we manually create a FileSystemWatcher and watch the 'parts' directory (here some dlls inside the folder) and track any changes, then we reflect the changes into a container which allows for recomposition.

Does MEF support auto-updating when the Container is using a DirectoryCatalog and it automatically for us ?

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

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

发布评论

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

评论(1

双手揣兜 2024-10-13 10:53:36

您需要调用 DirectoryCatalog 的 Refresh 方法以使用新内容进行更新。这将触发连接到目录的任何容器中的重组。您可以创建一个 FileSystemWatcher 并在发生任何更改时调用 Refresh 方法。

You need to call the Refresh method of the DirectoryCatalog for it to update with new contents. This will trigger recomposition in any containers hooked up to the catalog. You can create a FileSystemWatcher and call the Refresh method when anything changes.

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