MEF container auto-update using a directory-catalog
This is possible if we manually create a FileSystemWatcher
and watch the 'parts' directory (here some dlls inside the folder) and track any chan开发者_如何学运维ges, 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 ?
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.
精彩评论