Export (0) Print
Expand All

How to: Populate the Module Catalog from a Configuration File or a Directory in WPF

Overview

This topic describes how to create and populate the Module Catalog from a configuration file or a directory to load modules. Using these approaches, the shell does not contain a reference to the module's assembly; instead, modules are discovered when the application starts. By doing this, the shell is decoupled from the modules. This implies that you can add, update, or remove modules from your application without recompiling the shell.

These approaches require a module's discovering and loading process to be executed during startup and may result in reduced startup performance. In cases where decoupling modules from the shell is not a requirement, you should consider having references to the modules in the shell because it can reduce code complexity, simplify the application deployment, improve startup performance, and simplify debugging compared to populating the catalog at run time.

The Composite Application Library provides two different mechanisms to populate the module catalog at run time. Both approaches are only available in Windows Presentation Foundation (WPF). You can use either one, depending on your requirements and coding conventions. The following are the two ways that you can populate the module catalog at run time:

  • Directory lookup. This mechanism, implemented in the DirectoryModuleCatalog class, discovers modules in assemblies stored in a particular folder. This approach requires you to configure modules using attributes in code and does not require a configuration file. For information about how to use this mechanism, see Populating the Module Catalog from a Directory.
  • Configuration. This mechanism, implemented in the ConfigurationModuleCatalog class, discovers modules by reading the configuration file of the application. This approach requires a configuration file and does not require you to use attributes in code. For information about how to use this mechanism, see Populating the Module Catalog from a Configuration File.
Ff649191.note(en-us,PandP.10).gifNote:
This topic assumes that you are familiar with modules. For more information, see the Module technical concept.

Home page on MSDN | Community site

Show:
© 2014 Microsoft