Example #1
0
        public ChoObjConfigurable[] ConvertToDistinctArray(ChoObjConfigurable[] objConfigurables)
        {
            if (ChoGuard.IsArgumentNotNullOrEmpty(objConfigurables))
            {
                return(objConfigurables);
            }

            ChoDictionary <string, ChoObjConfigurable> _distinctObjectConfigurables = new ChoDictionary <string, ChoObjConfigurable>();

            foreach (ChoObjConfigurable objConfigurable in objConfigurables)
            {
                if (objConfigurable == null)
                {
                    continue;
                }
                if (String.IsNullOrEmpty(objConfigurable.Name))
                {
                    continue;
                }

                if (_distinctObjectConfigurables.ContainsKey(objConfigurable.Name))
                {
                    ChoTrace.Debug(String.Format("Item with {0} key already exists.", objConfigurable.Name));
                    continue;
                }

                _distinctObjectConfigurables.Add(objConfigurable.Name, objConfigurable);
            }

            return(_distinctObjectConfigurables.ToValuesArray());
        }
Example #2
0
 private static void DisposeAll()
 {
     foreach (ChoIniDocument iniDocument in _iniDocuments.ToValuesArray())
     {
         if (iniDocument == null)
         {
             continue;
         }
         iniDocument.Dispose();
     }
     _iniDocuments.Clear();
 }
Example #3
0
 private static void DisposeAll()
 {
     if (_globalObjectCache != null && _globalObjectCache.Count > 0)
     {
         foreach (object obj in _globalObjectCache.ToValuesArray())
         {
             if (obj != null && obj is IDisposable)
             {
                 ((IDisposable)obj).Dispose();
             }
         }
     }
 }
Example #4
0
 internal virtual void Clear()
 {
     if (_childProfiles != null)
     {
         lock (_childProfiles.SyncRoot)
         {
             foreach (IChoProfile profile in _childProfiles.ToValuesArray())
             {
                 profile.Dispose();
                 _Remove(profile);
             }
         }
     }
 }
Example #5
0
        public static void DisposeAll()
        {
            lock (MemberProfileCache.SyncRoot)
            {
                foreach (IChoProfile profile in MemberProfileCache.ToValuesArray())
                {
                    //SetAsNotDisposed(profile, true);

                    if (profile is IDisposable)
                    {
                        ((IDisposable)profile).Dispose();
                    }
                }
                MemberProfileCache.Clear();
            }
        }
Example #6
0
        //[ChoAppDomainUnloadMethod("Disposing all profile objects...")]
        public static void DisposeAll()
        {
            lock (MemberProfileCache.SyncRoot)
            {
                foreach (IChoProfile profile in MemberProfileCache.ToValuesArray())
                {
                    //SetAsNotDisposed(profile, true);

                    if (profile is IDisposable)
                    {
                        ((IDisposable)profile).Dispose();
                    }
                }
                MemberProfileCache.Clear();
            }
            lock (_profileCacheLock)
            {
                if (_profileCache != null)
                {
                    _profileCache.ForEach((keyValue) => keyValue.Value.Dispose());
                    _profileCache.Clear();
                }
            }
        }
Example #7
0
 public virtual void OnConfigurationStateChanged(object cmdInstruction, object tag)
 {
     try
     {
         if (_eventHandlerList != null)
         {
             int          counter = 0;
             WaitHandle[] handles = new WaitHandle[_eventHandlerList.Count];
             ChoConfigurationStateChangedEventArgs eventData = EventData;
             foreach (ChoConfigurationStateChangedEventHandler callback in _eventHandlerList.ToValuesArray())
             {
                 if (callback != null)
                 {
                     handles[counter++] = callback.BeginInvoke(this, new ChoConfigurationStateChangedEventArgs(_configsectionName, cmdInstruction, tag), null, null).AsyncWaitHandle;
                 }
             }
             WaitHandle.WaitAll(handles);
         }
     }
     catch (Exception ex)
     {
         ChoTrace.Write(ex);
     }
 }
 public static void Cleanup()
 {
     if (_dictService != null)
     {
         foreach (IChoConfigurationChangeWatcher configurationChangeWatcher in _dictService.ToValuesArray())
         {
             if (configurationChangeWatcher != null)
             {
                 configurationChangeWatcher.StopWatching();
             }
         }
         _dictService.Clear();
     }
 }