private void PutDeactivatedConnection(SqlInternalConnection con) { if (_state != State.ShuttingDown) { bool isInTransaction = con.Deactivate(); if (con.CanBePooled()) { // If manually enlisted, handle that case first! if (null != con.ManualEnlistedTransaction) { PutConnectionManualEnlisted(con); return; } // Try shoving it in the tx context. If that succeeds, // we're done. if (isInTransaction && TryPutResourceInContext(con)) { con.InPool = true; // mark as back in pool return; } // If the above failed, we just shove it into our current // store: PutNewConnection(con); } else { DestroyConnection(con); // Make sure we're at quota by posting a callback to the threadpool. ThreadPool.QueueUserWorkItem(new WaitCallback(PoolCreateRequest)); } } else { // If we're shutting down, we destroy the object. DestroyConnection(con); } }