Dec 22, 2008 at 9:50 PM
Edited Dec 22, 2008 at 9:55 PM
Why doesn't ModuleManager.LoadModule try to activate an already initialized module? Can this be done?
Dec 23, 2008 at 11:22 AM



The ModuleManager.LoadModule(“moduleName”) method is used to load modules on demand. Executing this method calls the Initialize method of the module you are trying to load and any modules that it has dependencies on.


What do you mean by “activate a module”?

If you want to call the Initialize method more than once, I would not recommend you to do this. The purpose of it is to be called only once during the module's loading process, to perform module configuration and set up.

If your purpose is performing a certain functionality of your module, what you could do is have your on demand modules’ initializers classes subscribe to an event in the EventAggregator. Then you can publish that same event in the event aggregator to perform your action.


The Composite Application Library provides several ways to implement loosely coupled communication among different modules. The following sections in the Prism-v2 documentation give some more light on these:

·         How to: Create and Publish Events

·         How to: Subscribe and Unsubscribe to Events

·         How to: Create Globally Available Commands

·         How to: Create Locally Available Commands


For more information about module loading you can the following sections in the help of Prism-v2:

·         Module: Technical Concept

·         Modularity Quickstarts for Silverlight/WPF

·         How To: Load Modules on Demand


Please let me know if this helps.


Damian Schenkelman

Dec 23, 2008 at 4:11 PM
Edited Dec 24, 2008 at 1:50 PM
Hi Damian,
Thanks for your answer.
Assume a ContentControl having 1 region in which modules are supposed to be displayed. When the Initialize method of a Module A is executed, it is then activated and Module A's view is shown in the region. If you then initialize Module B and activate it in the same region, it automatically deactivates Module A and shows Module B (that's when you have a ContentControl). However, if after that you do a LoadModule("ModuleA") again, nothing will happen, because Initialize() has already been executed.

My question was: why can't LoadModule("ModuleA") activate Module A, when I call this method the second time, after Module A has already been initialized?

- Gustavo

Edit: I understand that the app pool behavior is inherent to .Net and not limitation of Prism.