Exemple #1
0
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public virtual void Dispose()
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;

            lock (_instances)
                _instances.Remove(this);

            // Dispose of all the queries, where possible
            foreach (var disposableQuery in _queryObjects.OfType <IDisposable>())
            {
                disposableQuery.Dispose();
            }

            // Dispose of the DbConnectionPool
            _connectionPool.Dispose();
        }