ContextConfig v.1.1 Released

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:

If there is a value specified for the key for the current environment, it will be used.

If there is no matching value for this environment, but there is a default value, the specified default value will be used.

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.

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.

About the Author

Heather Floyd has been involved in website and software development for almost 20 years and developing with the Umbraco CMS since 2006. She specializes in information architecture and development efficiency. In addition, she has originated and contributed to various Umbraco and .Net-related open source projects. Heather speaks internationally about Umbraco and is a founder of the NYC Umbraco Meetup group. She currently provides development consulting as well as business strategy.