title: Petapoco and Azure SQL Connection Pool
body: <p>At the heart of Petapoco.cs there is the function OpenShareConnection.
  I believe this cannot take advantage of the Connection Pool in SQL Azure.
  I am monitoring my connections and the connection count grows above the pool limit.</p>
  
  <p>Anyone has done some improvements?</p>
  
  <p>Here is the OpenShareConnection (from Petapoco open source):</p>
  
  <pre><code>    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++;
      }
  </code></pre>