I have an app with a pretty big configuration. All configuration sections for each parameter are defined with .Net ConfigurationProperty attributes, that all have a DefaultValue property.
As our product becomes heavily customizable between countries, and even clients in one country, there is a Configurator.exe that enable to edit the big configuration file.
In this Configurator.exe, it would be really cool if I could have access to the many many many DefaultValue properties that has been defined... However, I don't have the single idea of how I could access those properties generated by the attributes.
e.g.:
public class MyCollection : ConfigurationElementCollection
{
public MyCollection ()
{
}
[ConfigurationProperty(MyAttr,IsRequired=false,DefaultValue=WantedValue)]
public MyAttributeType MyAttribute
{
//... property implementation
}
}
What I need is to programmatically access to the value WantedValue, the most generically as possible. (Otherwise I am to manually browse all the ConfigSections defined, collect the DefaultValues for each field, then check my configurator uses these values... )
In fancy it would look like: MyCollection.GetListConfigurationProperty() that would return ConfigurationPropertyAttribute objects on which I could call the Properties : Name, IsRequired, IsKey, IsDefaultCollection, and DefaultValue
Any idea ?