Using Transactions with Pooled Connections

Chia sẻ: Bui Tuan | Ngày: | Loại File: PDF | Số trang:1

0
31
lượt xem
4
download

Using Transactions with Pooled Connections

Mô tả tài liệu
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

    [ 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.

Chủ đề:
Lưu

Nội dung Text: Using Transactions with Pooled Connections

  1.     [ 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 ]  
Đồng bộ tài khoản