예제 #1
0
 public void Dispose()
 {
     try
     {
         L1Cache.Dispose();
     }
     finally
     {
         L2Cache.Dispose();
     }
 }
예제 #2
0
        ///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///  Releases the unmanaged resources used by the Hyperstore.Modeling.Domain.DomainModel and
        ///  optionally releases the managed resources.
        /// </summary>
        /// <param name="disposing">
        ///  true to release both managed and unmanaged resources; false to release only unmanaged
        ///  resources.
        /// </param>
        ///-------------------------------------------------------------------------------------------------
        protected virtual void Dispose(bool disposing)
        {
            var tmp = DomainUnloaded;

            if (tmp != null)
            {
                tmp(this, new EventArgs());
            }

            if (L1Cache != null)
            {
                L1Cache.Dispose();
            }

            var disposable = InnerGraph as IDisposable;

            if (disposable != null)
            {
                disposable.Dispose();
            }
            InnerGraph = null;

            disposable = _commandManager as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
            _commandManager = null;

            disposable = _eventManager as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
            _eventManager = null;

            disposable = IdGenerator as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
            IdGenerator = null;

            disposable = _modelElementFactory as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
            _modelElementFactory = null;

            Services.Dispose();
            _disposed = true;
        }