} // func FindPooledConnection internal IPpsConnectionHandle GetOrCreatePooledConnection(PpsDataSource dataSource, IPpsPrivateDataContext userData, bool throwException) { lock (pooledConnections) { var pooled = FindPooledConnection(dataSource); if (pooled == null) { var handle = dataSource.CreateConnection(userData, throwException); if (handle == null) { return(null); } pooledConnections.Add(new PooledConnection(handle)); Log.Info("New pooled connection: {0}", dataSource.Name); return(handle); } else { //Log.Info("Reuse pooled connection: {0}", dataSource.Name); return(pooled.Handle); } } } // func GetOrCreatePooledConnection
} // class PpsStringJoinExpression #endregion public async Task <IPpsConnectionHandle> EnsureConnectionAsync(PpsDataSource source, bool throwException) { var c = privateUser.GetOrCreatePooledConnection(source, this, throwException); if (c == null) { c = source.CreateConnection(this, throwException); } return(c != null && await c.EnsureConnectionAsync(throwException) ? c : null); } // func EnsureConnection