ModuleManader support in parallel modules loading

Topics: Prism v4 - Silverlight 4, Prism v4 - WPF 4
Jul 7, 2011 at 4:48 PM
Edited Jul 7, 2011 at 4:49 PM

In scenarios where manually loading two modules using IModuleManager.LoadModule

void OnPermissionsLoaded(Permission p)
  if(p.IsModule1Allow) _moduleManager.LoadModule("Module1");
  if(p.IsModule2Allow) _moduleManager.LoadModule("Module2");

In case there are dependent modules defined in the module-catalog they will be loaded as well and the LoadModuleCompleted event will be raised for each module and module.
In case a dependent module is being loaded and we get the LoadModuleCompleted event for it, in the EventArgs there is no info about the origin module that we called in ModuleManager.LoadModule for.

Another behavior of ModuleManager, if a dependent module failed to load, the entire module loading is stopped (make sense).

The Problem
When two module-loading are done in parallel and one of them failed since its dependent module failed to load, there is no way to know to which origin module that we tried to load, the failure relates to.
This prevent to correctly perform any custom handling in the application for each module. 


Problem in practice
When trying to extend Prism so region navigation will integrate with on-demand module-loading, it became more meaningful, since when navigating (INavigateAsync.RequestNavigate)
you expect to call the navigationCollback supplied delegate when navigation either failed or done, but since parallel module-loading failure cannot be correlated to the initiating navigation/module-load, it breaks.


Any solutions advices?



Jul 7, 2011 at 6:07 PM


You could create a work item in the issue tracker describing this undesired behavior, so that the team considers reviewing it for future versions.

On the other hand, you could also extend the module manager to support passing an identifier for the operation, so that you can obtain that information later on.


Guido Leandro Maliandi