Exemplo n.º 1
0
 protected DbConnectionFactory(DbConnectionPoolCounters performanceCounters)
 {
     _performanceCounters  = performanceCounters;
     _connectionPoolGroups = new Dictionary <DbConnectionPoolKey, DbConnectionPoolGroup>();
     _poolsToRelease       = new List <DbConnectionPool>();
     _poolGroupsToRelease  = new List <DbConnectionPoolGroup>();
     _pruningTimer         = CreatePruningTimer();
 }
Exemplo n.º 2
0
        internal void MakeNonPooledObject(object owningObject, DbConnectionPoolCounters performanceCounters)
        {
            // Used by DbConnectionFactory to indicate that this object IS NOT part of
            // a connection pool.

            _connectionPool      = null;
            _performanceCounters = performanceCounters;
            _owningObject.Target = owningObject;
            _pooledCount         = -1;
        }
Exemplo n.º 3
0
        internal void MakePooledConnection(DbConnectionPool connectionPool)
        {
            // Used by DbConnectionFactory to indicate that this object IS part of
            // a connection pool.

            // TODO: consider using ADP.TimerCurrent() for this.
            _createTime = DateTime.UtcNow; // WebData 111116

            _connectionPool      = connectionPool;
            _performanceCounters = connectionPool.PerformanceCounters;
        }
Exemplo n.º 4
0
        public virtual void Dispose()
        {
            _connectionPool              = null;
            _performanceCounters         = null;
            _connectionIsDoomed          = true;
            _enlistedTransactionOriginal = null; // should not be disposed

            // Dispose of the _enlistedTransaction since it is a clone
            // of the original reference.
            // VSDD 780271 - _enlistedTransaction can be changed by another thread (TX end event)
            SysTx.Transaction enlistedTransaction = Interlocked.Exchange(ref _enlistedTransaction, null);
            if (enlistedTransaction != null)
            {
                enlistedTransaction.Dispose();
            }
        }