devbridge/BetterCMS — pull request #1053 by trailmax (2014-05-21 00:49:11+00:00)
Title: Allowing for configuration overriding and setting it manually

Allowing for configuration overriding and setting it manually rather than having assigned from the config file.

Config files are useful as they are, but sometimes they are pain in the neck. And on 2 occasions I wanted to be able to set config values from code, rather than provide them from config files.
This little change will allow to create overrides for configuration/sections and substitute them instead of the config file:

public class AzureConfigurationForCms : CmsConfigurationSection, ICmsConfiguration
{
private CmsStorageConfiguration cachedStorageConfiguration;
ICmsStorageConfiguration ICmsConfiguration.Storage
{
get
{
if (cachedStorageConfiguration == null)
{
cachedStorageConfiguration = new MyCmsStorageConfiguration();
}
return cachedStorageConfiguration;
}
}
}

public class MyCmsStorageConfiguration: ICmsStorageConfiguration
{
// provide hardcoded values, or take them from my own code/configurations
}

Unfortunately I did not manage to get this to work properly, but my issues lie with asdfasdfasdf