What is a pre-requisite for connection pooling?
Thank you.
Assuming you mean database connections, the main points are:
- they must all use exactly the same connection string
- it is per-AppDomain
- for SSPI etc, the implicit user account must be common (i.e. the same domain user is being represented, or it will form multiple pools)
- it must be enabled and supported by the provider; in the case of
SqlConnection
it is on by default - you must have not explicitly disabled the pool
For most common cases using SqlConnection
, this just means "will be pooled per unique connection-string" - the rest is automatic and just works.
also; remember to use using
statements around your connection usage, so you release things back to the pool even in exception - otherwise you'll exhaust it.
A very interesting article although I am not entirely sure whether or not it is still valid.
精彩评论