【问题标题】:Petapoco and Azure SQL Connection PoolPetapoco 和 Azure SQL 连接池
【发布时间】: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


【解决方案1】:

https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql-server-connection-pooling

据我所知,Petapoco 正在与 ADO 连接池背后的基本前提作斗争,而不是创建新的 SQLConnection(string connectionString),然后在连接关闭时执行 .Close() 方法。

这 4 年除了蟋蟀唧唧喳喳什么都没有,这并不奇怪。 9 个月大的问题。

【讨论】:

    猜你喜欢
    • 2017-04-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-23
    • 2014-07-07
    • 1970-01-01
    相关资源
    最近更新 更多