Issues with dynamically loading modules in code with Silverlight/Prism
- by Greg Bailey
In my Bootstrapper.cs in GetModuleCatalog, I need to specify the Module types using the typeof(ModuleType). In the example below I'm trying to load the Contact module on demand, but in order to get it into my module catalog, I need to have a reference to it in the project that holds my Bootstrapper. When I add a reference to Contact, then the Contact.dll gets added to the initial xap file, which defeats the purpose of loading the module dynamically. Am I missing something? Do you have to load the module catalog from a file to make this work?
var catalog = new ModuleCatalog();
catalog.AddModule(typeof(Core));
catalog.AddModule(typeof(Contact), InitializationMode.OnDemand);