Context Sensitive Config Files
M. Keith Warren was asking for an enhancement to the web.config to look like:
<configuration Name=”Release”>
<system.web>
…
</system.web>
</configuration>
<configuration Name=”Debug”>
<system.web>
…
</system.web>
</configuration>
We solved a similar problem for all config files by creating a wrapper around AppSetting and ConfigurationSettings that looked at various things (machine name, database server, ...) to determine the environment and use the correct settings. I.e.
<appSettings>
<add key="logging-level" value="debug" />
</appSettings>
<test-environment>
<add key="logging-level" value="verbose" />
</test-environment>
<prod-environment>
<add key="logging-level" value="brief" />
</prod-environment>
This demonstrates also the cascading feature, if the environment is not specified the setting in appSettings is used, this way common settings don't have to be repeated.