microsoft prism catalog

Topics: Prism v2 - WPF 4, Prism v4 - WPF 4
Nov 26, 2012 at 10:08 PM

What is the difference between CreateModuleCatalog() and ConfigureModuleCatalog() in PRISM?
for example doing this:

protected override Microsoft.Practices.Prism.Modularity.IModuleCatalog CreateModuleCatalog()
            ModuleCatalog catalog = new ModuleCatalog();
            return catalog;

or this:

protected override void ConfigureModuleCatalog()
            Type moduleAType = typeof(ModuleAModule);
            ModuleCatalog.AddModule(new ModuleInfo()
                ModuleName = moduleAType.Name,
                ModuleType = moduleAType.AssemblyQualifiedName,
                InitializationMode = InitializationMode.WhenAvailable,
when to use one method or the other or i need to use both

Nov 27, 2012 at 5:10 PM


Based on my understanding the CreateModuleCatalog method is used to define the creation of the ModuleCatalog that will be used by your application. As you may find, by default, this method creates a ModuleCatalog instance, but this method can be overridden in a derived class in order to create different types of module catalogs. On the other hand, the ConfigureModuleCatalog method is used to modify the catalog after its creation, although as far as I know there may not be differences in adding the module in one method or the other, as the ConfigureModuleCatalog is called in the bootstrapping process right after the CreateModuleCatalog method. In my opinion this is mainly to maintain your code organized. Take into account that you should only add you module once (only in one of those methods).


Agustin Adami