Exemplo n.º 1
0
 static void watcher_Changed(object sender, System.IO.FileSystemEventArgs e)
 {
     _DbConfigReader = null;
 }
Exemplo n.º 2
0
        internal static ConfigReader Create()
        {
            if (_DbConfigReader != null)
                return _DbConfigReader;

            if (watcher == null)
            {
                watcher = new System.IO.FileSystemWatcher();
                watcher.Path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config");
                watcher.Filter = "*.config";
                watcher.Changed += new System.IO.FileSystemEventHandler(watcher_Changed);
                watcher.IncludeSubdirectories = true;
                watcher.EnableRaisingEvents = true;
            }

            _Mutex.WaitOne();
            if (_DbConfigReader == null)
                _DbConfigReader = new ConfigReader();
            _Mutex.ReleaseMutex();

            return _DbConfigReader;
        }