B
Brent Dunham
I'm developing a class library that uses the ConfigurationManager for
applicationSettings. I created a Setting Class deriving from
ConfigurationSection, added properties nad attributes to reflect the schema.
All is good on adding the new section, except that when the Section is
detected as not there and needs to be added, I need to grab the default
settings. This is not happening. The default settings ARE saved to the
config file, however the Configuration object returned has null values(not
default) unless I initaliize them during declaration. This is an issue as I
do not want to set the DefaultValue parameter of the ConfigurationProperty
attribute with a different literal than the initalization. What I'm hoping
is the when the Configuration.Save() method is called, I would reload the
Configuration object with a call to
ConfigurationManager.OpenExeConfiguration() This doesn't do the trick. All
properties are null rather than populated with default values I can see have
been written to the app.config.
Does anyone have any info on how to achieve this?
thanks,
Brent
applicationSettings. I created a Setting Class deriving from
ConfigurationSection, added properties nad attributes to reflect the schema.
All is good on adding the new section, except that when the Section is
detected as not there and needs to be added, I need to grab the default
settings. This is not happening. The default settings ARE saved to the
config file, however the Configuration object returned has null values(not
default) unless I initaliize them during declaration. This is an issue as I
do not want to set the DefaultValue parameter of the ConfigurationProperty
attribute with a different literal than the initalization. What I'm hoping
is the when the Configuration.Save() method is called, I would reload the
Configuration object with a call to
ConfigurationManager.OpenExeConfiguration() This doesn't do the trick. All
properties are null rather than populated with default values I can see have
been written to the app.config.
Does anyone have any info on how to achieve this?
thanks,
Brent