Passing Configuration FilePath Programmatically
In this topic, I’m going to show you how to pass configuration object filepath programmatically. Cinchoo framework addresses this feature through IChoConfigurationParametersOverridable interface. When you define a configuration object, implement this interface as below to override the configuration file path.
[ChoNameValueConfigurationSection("applicationSettings")]
public class ApplicationSettings : ChoConfigurableObject, IChoConfigurationParametersOverridable
{
[ChoPropertyInfo("path", DefaultValue = @"C:\")]
public string Path;
[ChoPropertyInfo("OS", DefaultValue = "Windows")]
public string OS;
public void OverrideParameters(ChoBaseConfigurationElement configurationElement)
{
configurationElement.ConfigFilePath = @"C:\Test\ApplicationSettings.xml";
}
}