Custom module configuration for Prism WPF modules

Topics: Prism v2 - WPF 3.5
May 4, 2011 at 1:58 PM

Hi - I'm trying to figure out a way to decouple the configuration my modules need from the Shell's app.config.  My scenario is this:

I'm running a fairly large project based on prism.  I've got different teams of developers working on different modules, each of which has it's own build/test/release schedule.  The modules use WCF services for data access, so I need configuration information persisted to support each module (URL for the service, Behaviors, etc).  I also have an authorization scheme that lets me specify what roles have access to what modules - I'm currently tracking the roles-module relationship in my app.config as well (suboptimal, but that's what I've got).  Finally, I use ClickOnce to deploy the shell and all of it's modules when I've got a new release.

In terms of deployment, I'd prefer to have my shell.exe deployed by ClickOnce along with very basic configuration information - basically just a couple of user settings for last window size and position, and then a pointer to a directory where the shell can find it's modules.  I've tested loading the modules from a network directory that shares it's root with the shell's ClickOnce instance and that seems to work fine.  Now I'd like to be able to deploy a module.config file for each module - this config would contain, at a minimum, the WCF configuration required to support the module.  I'd also like it to contain the list of roles that are permitted to see the module, but I can live without that.  The benefit to my project would be that we no longer need to redeploy the shell and all modules when a new module comes along or an existing module has fixes to be deployed.  I also wouldn't need to rebuild/redeploy my Shell project whenever a WCF configuration change was required.

Anyone have suggestions?

Thanks in advance.

May 4, 2011 at 2:49 PM

having config files per module ain't  a solution. Have a single config file for application. Load the modules via your config modules, henceforth you won't require to redeploy shell and all modules when a new module is introduced. You can differentiate every module by different namespace and hence can have various WCF configurations within a single file for respective modules.

May 4, 2011 at 6:54 PM
The problem I'm having is with ClickOnce and app.config. If I use the app.config as my single point of config, I *do* have to redeploy the shell every time I add a new module - every module has its own service dependencies/configuration and there's no way I could predict them in advance.

Out of curiosity, why don't you think modules carrying their own config is a good idea? I understand why a common assembly doing this would be troublesome, but modules won't be shared between applications. Also, without this ability the module isn't really loosely coupled any more - the shell needs specific knowledge of the module's dependencies for everything to work - kind of opposite to the dependency-injection philosophy as I understand it.


From: amoral [email removed]
Sent: Wednesday, May 04, 2011 09:49 AM
To: Jamie Fraser
Subject: Re: Custom module configuration for Prism WPF modules [CompositeWPF:256313]

From: amoral

having config files per module ain't a solution. Have a single config file for application. Load the modules via your config modules, henceforth you won't require to redeploy shell and all modules when a new module is introduced. You can differentiate every module by different namespace and hence can have various WCF configurations within a single file for respective modules.