adding exported parts to an exisiting MEF container
Is there a way to add exported parts from a catalog to an existing MEF CompositionContainer? I'm aware of ComposeExportedValue extension method, but what if I wanted to add a 开发者_StackOverflowwhole DirectoryCatalog to the list of exports? I don't need recomposition in this case, btw.
You can call DirectoryCatalog.Refresh to pick up new assemblies in a folder. To add entirely new catalogs, you could pass an AggregateCatalog to the container and then call .Add
on AggregateCatalog.Catalogs.
精彩评论