2012-11-27 121 views
4

Petapoco.cs的核心是OpenShareConnection功能。 我相信這不能利用SQL Azure中的連接池。 我正在監視我的連接,並且連接計數增長超過池限制。Petapoco和Azure SQL連接池

任何人都做了一些改進?

這裏是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++; 
    } 

回答