Load module in prism framework based on role through config file

Jun 19, 2008 at 6:53 AM
Edited Jun 19, 2008 at 10:50 AM

I am working with prism framework and having three modules. how can i load this three modules based on the role through config file?.
or is there any other way to load modules based on the roles?

please anyone help me as soon as possible.

Jun 20, 2008 at 1:01 AM
Edited Jun 20, 2008 at 1:02 AM
Hi J

The modue loader out of the box won't do this for you. What you can do though is create your own module loader (by implementing IModuleLoader) that will check group permissions before loading a module Then you will need to register your version in the container. If you are using the UnityPrismBootstrapper, you can do this by overriding the ConfigureContainer method. In that method register the new ModuleLoader BEFORE you call the base. In the base we call a RegisterTypeIfMissing method that will only register our ModuleLoader if an IModuleLoader has not already been registered.


Jan 13, 2010 at 7:29 PM
Edited Jan 13, 2010 at 7:29 PM


Do you have any examples of this?  I am looking for something like the Smart Client Baseline Architecture Toolkit (SC-BAT).   Using the module loader extensions provided by CAB, SC-BAT provides a module loader that will download any optional module by using role-based information loaded from the authentication service. Roles can be assigned to each module by using the schema in the profile catalog.  Only those modules assigned to any one role will be downloaded to the desktop from the server. 

What needs to be done to make PRISM work this way? 


       <ModuleInfo AssemblyFile ="Desktop.Module.CustomerModule.dll" />


                     <Role Allow="RoleA"/>


       <ModuleInfo AssemblyFile ="Desktop.Module.OnlineBankingModule.dll">


                     <Role Allow="RoleB"/>




Geoff Niehaus, MCPD:EA

Jan 14, 2010 at 4:53 AM

As far as I know there is nothing in Prism equivelent to the role-based loading / profile catalog type support in SCSF.

Jan 14, 2010 at 7:05 PM


It looks like the SCSF has not been updated since April of 2008, and I don't see any planned updates.  I am not interested in going with any technology that is not being moved forward.  PRISM is the only one I am aware of that will have .NET 4.0 support (e.g. MEF, etc.).  The project I am starting has the potential of having several hundred modules and not all users will need all modules.  I am thinking that having some kind of configurable role-based module loading will keep users from getting application updates to modules they are not using, and allow them to get new modules if their role changes.

Maybe there is a better approach here.  What would you recommend around controlling what modules get loaded in a configurable way based on what role and/or subscription a user has?  What I am hearing is that I have to roll my own code for this, or should I wait a few months...


Geoff Niehaus, MCPD:EA

Jan 19, 2010 at 6:01 PM

Hi Geoff,

The SCSF is going to be updated for VS 2010 as you can read in this blog post by Don Smith. As Glenn said, there is not an out-of-the-box way in Prism-v2 to perform role based module loading, but the following thread deals with a similar question (which also has links to many other threads) and might be useful:

Another thing you might find useful is proposing this kind of feature/guidance to be in for the next Prism version. You can do that either here or in the Issue Tracker.

Please let me know if this helps.

Damian Schenkelman