uglybugger/ConfigInjector — pull request #2 by caleb-vear (2013-10-15 04:38:51+00:00)
Title: Allow types not handled by Convert.ChangeType

I discovered that I couldn't use a `System.TimeSpan` as a setting type. I needed a bunch of them in the settings for my current application so I made this change to make it possible. Now to create a `TimeSpan` setting all I need to do is:

public abstract class TimeSpanConfigurationSetting : ConfigurationSetting
{
protected override TimeSpan ConvertStringValue(string settingValueString)
{
return TimeSpan.Parse(settingValueString);
}
}

I'm not 100% happy with this solution as it probably shouldn't be the responsibility of the setting to read the string, but it was the quickest to implement non-nasty solution I could come up with.

I think a better solution would be to be able to specify a chain of converters using the `ConfigurationConfigurator`. Let me know what you think and if you'd rather it was done that way you could change it or wait for me to get around to it when I have some more free time :)