internal override void OpenConnection(DbConnection outerConnection, System.Data.ProviderBase.DbConnectionFactory connectionFactory)
 {
     if (connectionFactory.SetInnerConnectionFrom(outerConnection, System.Data.ProviderBase.DbConnectionClosedConnecting.SingletonInstance, this))
     {
         System.Data.ProviderBase.DbConnectionInternal to = null;
         try
         {
             connectionFactory.PermissionDemand(outerConnection);
             to = connectionFactory.GetConnection(outerConnection);
         }
         catch
         {
             connectionFactory.SetInnerConnectionTo(outerConnection, this);
             throw;
         }
         if (to == null)
         {
             connectionFactory.SetInnerConnectionTo(outerConnection, this);
             throw System.Data.Common.ADP.InternalConnectionError(System.Data.Common.ADP.ConnectionError.GetConnectionReturnsNull);
         }
         connectionFactory.SetInnerConnectionEvent(outerConnection, to);
     }
 }
 internal virtual void CloseConnection(DbConnection owningObject, System.Data.ProviderBase.DbConnectionFactory connectionFactory)
 {
     Bid.PoolerTrace("<prov.DbConnectionInternal.CloseConnection|RES|CPOOL> %d# Closing.\n", this.ObjectID);
     if (connectionFactory.SetInnerConnectionFrom(owningObject, System.Data.ProviderBase.DbConnectionOpenBusy.SingletonInstance, this))
     {
         try
         {
             System.Data.ProviderBase.DbConnectionPool pool = this.Pool;
             Transaction enlistedTransaction = this.EnlistedTransaction;
             if ((null != enlistedTransaction) && (enlistedTransaction.TransactionInformation.Status != TransactionStatus.Active))
             {
                 this.DetachTransaction(enlistedTransaction, true);
             }
             if (pool != null)
             {
                 pool.PutObject(this, owningObject);
             }
             else
             {
                 this.Deactivate();
                 this.PerformanceCounters.HardDisconnectsPerSecond.Increment();
                 this._owningObject.Target = null;
                 if (this.IsTransactionRoot)
                 {
                     this.SetInStasis();
                 }
                 else
                 {
                     this.PerformanceCounters.NumberOfNonPooledConnections.Decrement();
                     this.Dispose();
                 }
             }
         }
         finally
         {
             connectionFactory.SetInnerConnectionEvent(owningObject, System.Data.ProviderBase.DbConnectionClosedPreviouslyOpened.SingletonInstance);
         }
     }
 }