FileConfigurationSource

Topics: Enterprise Library Core
Oct 25, 2007 at 9:24 PM
I am storing the configuration for my application in a File and referencing the file with the FileConfigurationSource. I allow the users of my application to modify what they would like to have logged and where it should be logged to. I use the API of Enterprise Library to modify the configuration. It seems to work in memory but it not reflected in the file. How do I flush the configuration back to the file that I have read the configuration from.

Below is a code snippet of what I am doing.

Thanks for you help.

Jon


ConfigurationSourceSection cse = (ConfigurationSourceSection)ConfigurationManager.GetSection("enterpriseLibrary.ConfigurationSource");
FileConfigurationSourceElement fcse = (FileConfigurationSourceElement)cse.Sources.Get(cse.SelectedSource);
FileConfigurationSource configFile=new FileConfigurationSource(fcse.FilePath);
LoggingSettings logSettings = (LoggingSettings)configFile.GetSection("loggingConfiguration");
NameTypeConfigurationElementCollection<LogFilterData, CustomLogFilterData> Filters = logSettings.LogFilters;
LogEnabledFilterData enableFilter = (LogEnabledFilterData)Filters.Get("LogEnabled Filter");
enableFilter.Enabled =true;