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++;
}