开发者

how can i change enterprise library connection state

I am using Microsoft Enterprise Library for MS SQL. Enterprise Library automatically closes its connection, but I don't want it to close.

How can I keep ope开发者_JAVA百科n an Enterprise Library Connection?


Actually, it doesn't work that way. The .NET level DbConnection will open and close, yes. But down the the ADO.NET driver, the physical connection to the database (the one that actually requires client & server resources) doesn't get opened and closed for each one. The ADO.NET driver manages a pool of physical connections. So each one of those 52000 connections is actually sharing the same physical underlying connection. It's not really costing you anything.

The connection management is actually about 50% of the reason the Data Access block exists, so there's no easy switch to turn it off. The best you can do would be to create the DbConnection manually and pass it to the overloads that take a connection. But then you need to manage it yourself. At that point you're probably better off just calling ADO.NET directly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜