After reviewing the service layer of an application to verify that all SqlConnections were properly being cleaned up, I thought I would post my findings on the details of how the SqlCommand and SqlConnection objects work with ADO.Net connection pooling.
I found several blogs/threads that stated "calling dispose on a SqlCommand instance will in turn clean up the underlying connection and remove it from the ADO.Net connection pool". This is not quite the case. I put performance monitor on task, and while watching NumberOfActiveConnections and NumberOfPooledConnections, it was clear that the active connection was never closed by calling SqlCommand.Dispose(). A review of MSDN documentation on the dispose method simply states: "Releases all resources used by the Component. (Inherited from Component.)".
