【发布时间】:2012-11-15 15:55:15
【问题描述】:
Petapoco.cs 的核心是函数 OpenShareConnection。 我相信这不能利用 SQL Azure 中的连接池。 我正在监视我的连接,并且连接数超过了池限制。
有人做了一些改进吗?
这里是 OpenShareConnection(来自 Petapoco 开源):
public void OpenSharedConnection()
{
if (_sharedConnectionDepth == 0)
{
//read the connection string from web.config and
//create a new connection
_sqlConnection = _factory.CreateConnection();
_sqlConnection.ConnectionString = _connectionString;
// Wrap this method with a retry policy.
_sqlConnection.Open();
_sqlConnection = OnConnectionOpened(_sqlConnection);
if (KeepConnectionAlive)
_sharedConnectionDepth++; // Make sure you call Dispose
}
_sharedConnectionDepth++;
}
【问题讨论】:
-
你解决过这个问题吗?
标签: connection-pooling azure-sql-database petapoco