Example #1
0
        override protected void Deactivate()
        {
            try
            {
                SqlReferenceCollection referenceCollection = (SqlReferenceCollection)ReferenceCollection;
                if (null != referenceCollection)
                {
                    referenceCollection.Deactivate();
                }

                // Invoke subclass-specific deactivation logic
                InternalDeactivate();
            }
            catch (Exception e)
            {
                if (!ADP.IsCatchableExceptionType(e))
                {
                    throw;
                }

                // if an exception occurred, the inner connection will be
                // marked as unusable and destroyed upon returning to the
                // pool
                DoomThisConnection();
            }
        }
 internal SqlCommand FindLiveCommand(TdsParserStateObject stateObj)
 {
     SqlCommand command = null;
     SqlReferenceCollection referenceCollection = (SqlReferenceCollection)ReferenceCollection;
     if (null != referenceCollection)
     {
         command = referenceCollection.FindLiveCommand(stateObj);
     }
     return command;
 }
 internal SqlDataReader FindLiveReader(SqlCommand command)
 {
     SqlDataReader reader = null;
     SqlReferenceCollection referenceCollection = (SqlReferenceCollection)ReferenceCollection;
     if (null != referenceCollection)
     {
         reader = referenceCollection.FindLiveReader(command);
     }
     return reader;
 }
        internal SqlDataReader FindLiveReader(SqlCommand command)
        {
            SqlDataReader          reader = null;
            SqlReferenceCollection referenceCollection = (SqlReferenceCollection)base.ReferenceCollection;

            if (referenceCollection != null)
            {
                reader = referenceCollection.FindLiveReader(command);
            }
            return(reader);
        }
        protected override void Deactivate()
        {
            if (Bid.AdvancedOn)
            {
                Bid.Trace("<sc.SqlInternalConnection.Deactivate|ADV> %d# deactivating\n", base.ObjectID);
            }
            SNIHandle target = null;

            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                target = GetBestEffortCleanupTarget(this.Connection);
                SqlReferenceCollection referenceCollection = (SqlReferenceCollection)base.ReferenceCollection;
                if (referenceCollection != null)
                {
                    referenceCollection.Deactivate();
                }
                this.InternalDeactivate();
            }
            catch (OutOfMemoryException)
            {
                base.DoomThisConnection();
                throw;
            }
            catch (StackOverflowException)
            {
                base.DoomThisConnection();
                throw;
            }
            catch (ThreadAbortException)
            {
                base.DoomThisConnection();
                BestEffortCleanup(target);
                throw;
            }
            catch (Exception exception)
            {
                if (!ADP.IsCatchableExceptionType(exception))
                {
                    throw;
                }
                base.DoomThisConnection();
                ADP.TraceExceptionWithoutRethrow(exception);
            }
        }
Example #6
0
        override protected void Deactivate()
        {
            if (Bid.AdvancedOn)
            {
                Bid.Trace("<sc.SqlInternalConnection.Deactivate|ADV> %d# deactivating\n", base.ObjectID);
            }
            TdsParser bestEffortCleanupTarget = null;

            RuntimeHelpers.PrepareConstrainedRegions();
            try {
#if DEBUG
                TdsParser.ReliabilitySection tdsReliabilitySection = new TdsParser.ReliabilitySection();

                RuntimeHelpers.PrepareConstrainedRegions();
                try {
                    tdsReliabilitySection.Start();
#else
                {
#endif //DEBUG
                    bestEffortCleanupTarget = SqlInternalConnection.GetBestEffortCleanupTarget(Connection);
                    SqlReferenceCollection referenceCollection = (SqlReferenceCollection)ReferenceCollection;
                    if (null != referenceCollection)
                    {
                        referenceCollection.Deactivate();
                    }

                    // Invoke subclass-specific deactivation logic
                    InternalDeactivate();
                }
#if DEBUG
                finally {
                    tdsReliabilitySection.Stop();
                }
#endif //DEBUG
            }
            catch (System.OutOfMemoryException) {
                DoomThisConnection();
                throw;
            }
            catch (System.StackOverflowException) {
                DoomThisConnection();
                throw;
            }
            catch (System.Threading.ThreadAbortException) {
                DoomThisConnection();
                SqlInternalConnection.BestEffortCleanup(bestEffortCleanupTarget);
                throw;
            }
            catch (Exception e) {
                //
                if (!ADP.IsCatchableExceptionType(e))
                {
                    throw;
                }

                // if an exception occurred, the inner connection will be
                // marked as unusable and destroyed upon returning to the
                // pool
                DoomThisConnection();

                ADP.TraceExceptionWithoutRethrow(e);
            }
        }