Esempio n. 1
0
        private ConfigurationSourceWatcher CreateWatcherForConfigSource(string configSource)
        {
            ConfigurationSourceWatcher watcher;

            if (string.Empty == configSource)
            {
                watcher = new ConfigurationFileSourceWatcher(configurationFilepath,
                                                             configSource,
                                                             refresh,
                                                             this.refreshInterval,
                                                             OnConfigurationChanged);
                configFileWatcher = watcher;
            }
            else
            {
                watcher = new ConfigurationFileSourceWatcher(configurationFilepath,
                                                             configSource,
                                                             refresh && !NullConfigSource.Equals(configSource),
                                                             this.refreshInterval,
                                                             OnExternalConfigurationChanged);
            }

            watchedConfigSourceMapping.Add(configSource, watcher);

            return(watcher);
        }
Esempio n. 2
0
 private void UnlinkWatcherForSection(ConfigurationSourceWatcher watcher, string sectionName)
 {
     watchedSectionMapping.Remove(sectionName);
     watcher.WatchedSections.Remove(sectionName);
     if (watcher.WatchedSections.Count == 0 && configFileWatcher != watcher)
     {
         RemoveConfigSourceWatcher(watcher);
     }
 }
Esempio n. 3
0
 private static void AddSectionsToUpdate(
     ConfigurationSourceWatcher watcher,
     IDictionary <string, string> sectionsToUpdate)
 {
     foreach (string section in watcher.WatchedSections)
     {
         sectionsToUpdate.Add(section, watcher.ConfigSource);
     }
 }
Esempio n. 4
0
 private void RemoveConfigSourceWatcher(ConfigurationSourceWatcher watcher)
 {
     watchedConfigSourceMapping.Remove(watcher.ConfigSource);
     (watcher as IDisposable).Dispose();
 }
Esempio n. 5
0
 private void LinkWatcherForSection(ConfigurationSourceWatcher watcher, string sectionName)
 {
     watchedSectionMapping.Add(sectionName, watcher);
     watcher.WatchedSections.Add(sectionName);
 }
 private void UnlinkWatcherForSection(ConfigurationSourceWatcher watcher, string sectionName)
 {
     watchedSectionMapping.Remove(sectionName);
     watcher.WatchedSections.Remove(sectionName);
     if (watcher.WatchedSections.Count == 0 && configFileWatcher != watcher)
     {
         RemoveConfigSourceWatcher(watcher);
     }
 }
 private void RemoveConfigSourceWatcher(ConfigurationSourceWatcher watcher)
 {
     watchedConfigSourceMapping.Remove(watcher.ConfigSource);
     (watcher as IDisposable).Dispose();
 }
 private void LinkWatcherForSection(ConfigurationSourceWatcher watcher, string sectionName)
 {
     watchedSectionMapping.Add(sectionName, watcher);
     watcher.WatchedSections.Add(sectionName);
 }
        private ConfigurationSourceWatcher CreateWatcherForConfigSource(string configSource)
        {
            ConfigurationSourceWatcher watcher;

            if (string.Empty == configSource)
            {
                watcher = new ConfigurationFileSourceWatcher(configurationFilepath,
                                                             configSource,
                                                             refresh,
                                                             this.refreshInterval,
                                                             OnConfigurationChanged);
                configFileWatcher = watcher;
            }
            else
            {
                watcher = new ConfigurationFileSourceWatcher(configurationFilepath,
                                                             configSource,
                                                             refresh && !NullConfigSource.Equals(configSource),
                                                             this.refreshInterval,
                                                             OnExternalConfigurationChanged);
            }

            watchedConfigSourceMapping.Add(configSource, watcher);

            return watcher;
        }
 private static void AddSectionsToUpdate(
     ConfigurationSourceWatcher watcher,
     IDictionary<string, string> sectionsToUpdate)
 {
     foreach (string section in watcher.WatchedSections)
     {
         sectionsToUpdate.Add(section, watcher.ConfigSource);
     }
 }