From the understanding, .Internet will pool SqlConnection objects in which the Connection String is identical automatically. Will the bond be put basically call the Dispose method? This is requested underneath the context of the ASP .Internet application that sometimes makes many hits towards the database in one PageLoad event. I would like the connections to become put, but would really like confirmation that Closing and Getting rid of from the connection when the data operation is done doesn't hinder .Net's handling from the connection pool.
When utilizing connection pooling, closing a
SqlConnection simply informs the bond pool that you're completed with it. The pool will decide if you should really close the bond, in order to reuse it.
In the MSDN docs:
When the SqlConnection is out of scope, it will not be closed. Therefore, you have to clearly close the bond by calling Close or Dispose. Close and Dispose are functionally equivalent. When the connection pooling value Pooling is placed to true or yes, the actual connection is came back to the bond pool. However, if Pooling is placed to false or no, the actual link with the server is closed.
The MSDN documentation on SQL Server Connection Pooling states
Connections are launched into the pool when they're closed or disposed
We highly recommend that you simply always close the bond whenever you are finished utilizing it to ensure that the bond is going to be came back towards the pool. This can be done using either the Close or Dispose techniques from the Connection object ...
Also, it's the connection pooler which will determine whether the connections are dropped in the pool
The bond pooler removes an association in the pool after it's been idle for any very long time, or maybe the pooler picks up the reference to the server continues to be severed
From the understanding, .Internet will pool SqlConnection objects
No, the SQL provider will pool the actual connections to SQL Server (with separate pools in line with the connection string).
SqlConnection objects will obtain a put connection (or create a replacement, etc, according to what's set up for pooling, whether a put connection can be obtained) when
Open is known as, and can release the bond when
Dispose is known as.
The 2 concepts (
SqlConnection objects, and actual connections to SQL Server) are distinct, but clearly somewhat related.