Get list of discovered modules so you can later initialize them?

Topics: Prism v4 - WPF 4
Jul 27, 2010 at 7:19 PM

If you use MEF and a DirectoryCatalog, it is possible that you won't know the name of a module prior to runtime.  I don't see how you can get a list of modules in the catalog from IModuleManager.

This is not an issue if the module is set to init WhenAvailable, but you are hosed if it is set to OnDemand.

Am I missing something here?

Jul 28, 2010 at 6:14 PM

You should be able to :

  • look through the module catalog's Modules collection
  • look at the ModuleExport metatdata on the types. by default the type name becomes the module name.
  • add another piece of metadata you can interrogate

I hope that helps a bit,

Michael Puleio