Frameworks such as PRISM and MEF make it very easy to design complex applications out of multiple, composable components. One common example of this is a plug-in architecture where an application shell can be dymanically reconfigured with plug-in UI components (eg by dropping DLLs into a Plug-ins
directory).
This is all well and good, but as Vaccano spotted in Can Prism be modular when calling webservices? there are circumstances where each individual plug-in requires its own set of configuration - WCF bindings being a typical example, but there are many other scenarios (logging, database connections, etc.) with similar needs.
So, as I see it, the options we have are:
- All config goes into the
App.config
of the shell application (which as Vaccano mentioned breaks the whole encapsulation & deployment advantages of this model), or - Each plug-in assembly uses a bespoke mechanism for config (eg an embedded resource) and then uses this to dynamically configure a WCF service, for example (which at best is messy and time consuming, and at worst may not be possible)
Neither of these options are ideal, but they are workarounds. However, the ideal situation would be for each plug-in DLL to have either self contained config (such as an embedded resource file) or an Xxx.dll.config
file, and have each of these XML config fragments merged into the App.config
configuration of the shell application dynamically at runtime. This is reminiscent of the way Machine.config
and App.config
files are merged.
My question, therefore, is: has anyone come across any existing frameworks or techniques which could be used to allow this dynamic merging of composite config files into the in-process configuration of the container application? I am surprised not to see this as part of PRISM or MEF and therefore slightly wary of posting this question in case I have missed something obvious - if so, please just quietly post the relevant link :)