Populating the ModuleCatalog

Topics: Prism v2 - Silverlight 3
Nov 3, 2009 at 4:49 PM
Edited Nov 3, 2009 at 4:52 PM

Has anyone had any luck populating the module catalog without adding a direct references in the shell?

This is what I have:

var loginModuleInfo = new ModuleInfo()
{
    Ref = "file://ModuleA.dll",
    InitializationMode = InitializationMode.WhenAvailable,
    ModuleName = "ModuleA",
    ModuleType = "CompositeApp.Modules.ModuleA.ModuleA, CompositeApp.Modules.ModuleA, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
};

ModuleCatalog catalog = new ModuleCatalog();
catalog.AddModule(loginModuleInfo);
return catalog;

If I add the ModuleA reference to the shell project this works fine. But when I remove the reference I get the following error:

Failed to load type for module ModuleA. Error was: An exception occurred during a WebClient request

I thought the shell and modules were able to operate without knowledge of eachother. So I guess my question is: Do I have to add the ModuleA.dll reference to the shell for this concept to work?   

Thanks

Rob

Nov 3, 2009 at 7:41 PM

If you want to avoid having the shell reference a module then you could use a configuration file to define which modules to load.

Nov 3, 2009 at 8:00 PM

Hi Rob,

As you explain, the Shell and modules should operate with no references of each other. An easy way to achieve the functionality you want, without using code, is having the module’s configuration in a separated XAML file. The Remote Modularity Quickstart that comes with Prism and this port of the RI to remote module loading use that approach, so you might find them useful.

This document from the Prism-v2 RI provides some more information about this topic:

Please let me know if this helps.

Damian Schenkelman
http://blogs.southworks.net/dschenkelman