I'm trying to use the .Net confgiuration model to handle the ability to load and merge together a heirachy of configuration files in a similar way to how the heirachical ASP.Net web confgiuration files are merged together.
Thanks to the excellent Unraveling the Mysteries of .NET 2.0 Configuration series of articles I've figured out how to do most things, but I'm having some trouble specifying the exact heirachy of configuration files to be loaded. Just as with web.config files there can potentially be an infinite heirachy of configuration files to load and the rules about exactly which files should be included needs to be determined at runtime.
As an example of the sort of heirachy I'm talking about - if a user is working on a file "c:\User\jblogs\Documents\Projects\MyApp\AppFile12.txt" then I might want the following files to be included in the heirachy:
- c:\User\jblogs\Documents\Projects\MyApp\myapp.config
- c:\User\jblogs\Documents\Projects\myapp.config
- c:\User\jblogs\myapp.config
- c:\Program Files\MyApp\config\myapp.config
(Disclaimer: The above is a simplified example of what I want to achieve, but I think that if I can figure out how to do the above then I will have cracked it)
I've even tried looking at the web.config code in Reflector, but its tricky to understand exactly what's going on - can anyone who understands this a bit better points me in the right direction?