Tải bản đầy đủ (.pdf) (1 trang)

Tài liệu Using Transactions with Pooled Connections pptx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (24.5 KB, 1 trang )

 
 
[ Team LiB ]


Recipe 1.17 Using Transactions with Pooled Connections
Problem
You want to use connection pooling with transactions in your .NET application to
maximize performance.
Solution
The discussion explains how to use connection pooling with transactions.
Discussion
Connections participating in transactions are drawn from the connection pool and
assigned based on an exact match with the transaction context of the requesting thread
and with the connection string.
Each connection pool is divided into a subdivision for connections without a transaction
context and zero or more subdivisions for connections associated with a particular
transaction context. Each of these subdivisions, whether associated with a transaction
context or not, uses connection pooling based on exact matching of the connection string
as described in Recipe 1.15
.
When a thread associated with a particular transaction context requests a connection, one
from the appropriate pool enlisted with that transaction is automatically returned.
When a connection is closed it is returned to the appropriate subdivision in the
connection pool based on the transaction context. This allows a connection to be closed
without generating an error even if a distributed transaction is still pending. The
transaction can committed or aborted later.
[ Team LiB ]

 

×