Esempio n. 1
0
        public override void Close()
        {
            InnerConnection.CloseConnection(this, ConnectionFactory);

            OdbcConnectionHandle connectionHandle = _connectionHandle;

            if (null != connectionHandle)
            {
                _connectionHandle = null;

                // If there is a pending transaction, automatically rollback.
                WeakReference weak = _weakTransaction;
                if (null != weak)
                {
                    _weakTransaction = null;
                    IDisposable transaction = weak.Target as OdbcTransaction;
                    if ((null != transaction) && weak.IsAlive)
                    {
                        transaction.Dispose();
                    }
                    // else transaction will be rolled back when handle is disposed
                }
                connectionHandle.Dispose();
            }
        }
Esempio n. 2
0
        private void CloseInnerConnection()
        {
            // CloseConnection() now handles the lock

            // The SqlInternalConnectionTds is set to OpenBusy during close, once this happens the cast below will fail and
            // the command will no longer be cancelable.  It might be desirable to be able to cancel the close operation, but this is
            // outside of the scope of Whidbey RTM.  See (SqlCommand::Cancel) for other lock.
            InnerConnection.CloseConnection(this, ConnectionFactory);
        }
Esempio n. 3
0
 public override void Close()
 {
     InnerConnection.CloseConnection(this, ConnectionFactory);
     // does not require GC.KeepAlive(this) because of OnStateChange
 }