示例#1
0
 public void Dispose()
 {
     if (Interlocked.Exchange(ref _disposed, 1) == 0)
     {
         // unhook domain events
         DisposeSafeCritical();
         // stats must be disposed prior to disposing the stores.
         if (_stats != null)
         {
             _stats.Dispose();
         }
         if (_storeRefs != null)
         {
             foreach (var storeRef in _storeRefs)
             {
                 if (storeRef != null)
                 {
                     storeRef.Dispose();
                 }
             }
         }
         if (_perfCounters != null)
         {
             _perfCounters.Dispose();
         }
         GC.SuppressFinalize(this);
     }
 }