Today I've just released version 1.1 of ContextConfig. The main update is support for overriding ConfigurationManager.AppSettings["key"] to check the ContextConfig file before defaulting to the web.config value. What this means is that, if enabled (It can be disabled easily, if you don't want the functionality), you don't need to use the ContextConfig.GetValue("key") syntax in your code. It also means that any current existing code which looks for appkeys will automatically support ContextConfig.

When enabled, any calls to ConfigurationManager.AppSettings["key"] will utilize ContextConfig data as follows:

  1. If there is a value specified for the key for the current environment, it will be used.
  2. If there is no matching value for this environment, but there is a default value, the specified default value will be used.
  3. If there is no record of the key in the ContextConfig.config file, it will use the value specified in the web.config <appSettings> section.
  4. If there is no matching key in the web.config, an empty string will be returned, as usual.

To enable “Override Configuration Manager” mode, a call needs to be made at application start to “ContextConfigOverride.ActivateOverride().” An HttpModule class has been included, so the call can be made in a web application by simply registering the HttpModule in the application’s web.config and setting the ContextConfig.config “OverrideConfigurationManager” attribute to "true". Alternatively, a call in the Global.asax “Application_Start()” section can be used.

Check out the documentation for all the details.

Get the updated Umbraco Package or the Source Code to use in any ASP.Net web project.

Watch the version 1.0 Demo video.

PS. Please Vote on possible new features