public void Initialize() { ConfigurationChangeFileWatcher.SetDefaultPollDelayInMilliseconds(1000); configFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; configurationSettings = new ConfigurationSettings(); ConfigurationSectionData sectionA = new ConfigurationSectionData(sectionAName); configurationSettings.ConfigurationSections.Add(sectionA); sectionA.Transformer = new XmlSerializerTransformerData(sectionAName); sectionA.Transformer.TypeName = typeof(MockTransformer).AssemblyQualifiedName; XmlFileStorageProviderData storageProviderData = new XmlFileStorageProviderData(fooName, fooConfig); sectionA.StorageProvider = storageProviderData; ConfigurationSectionData sectionB = new ConfigurationSectionData("SectionB"); configurationSettings.ConfigurationSections.Add(sectionB); sectionB.Transformer = new XmlSerializerTransformerData(sectionAName); sectionB.Transformer.TypeName = typeof(XmlSerializerTransformer).AssemblyQualifiedName; XmlFileStorageProviderData fooStorageProviderData = new XmlFileStorageProviderData(fooName, fooConfig); sectionB.StorageProvider = fooStorageProviderData; }
private void SetTracingFlag(bool tracingEnabled) { ConfigurationChangeFileWatcher.SetDefaultPollDelayInMilliseconds(100); SystemConfigurationSource.ResetImplementation(true); Logger.Reset(); SysConfig.Configuration config = SysConfig.ConfigurationManager.OpenExeConfiguration(SysConfig.ConfigurationUserLevel.None); Logging.Configuration.LoggingSettings loggingSettings = config.GetSection(Logging.Configuration.LoggingSettings.SectionName) as Logging.Configuration.LoggingSettings; loggingSettings.TracingEnabled = tracingEnabled; config.Save(); SysConfig.ConfigurationManager.RefreshSection(Logging.Configuration.LoggingSettings.SectionName); SystemConfigurationSource.Implementation.ConfigSourceChanged(string.Empty); Thread.Sleep(200); }
public void Initialize() { configFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; context = new ConfigurationContext(new DisposingWrapper(new ConfigurationBuilder(configFile))); ConfigurationChangeFileWatcher.SetDefaultPollDelayInMilliseconds(100); }