private DbConnectionPool GetConnectionPool(DbConnection owningObject, DbConnectionPoolGroup connectionPoolGroup) { // if poolgroup is disabled, it will be replaced with a new entry Debug.Assert(null != owningObject, "null owningObject?"); Debug.Assert(null != connectionPoolGroup, "null connectionPoolGroup?"); // It is possible that while the outer connection object has // been sitting around in a closed and unused state in some long // running app, the pruner may have come along and remove this // the pool entry from the master list. If we were to use a // pool entry in this state, we would create "unmanaged" pools, // which would be bad. To avoid this problem, we automagically // re-create the pool entry whenever it's disabled. // however, don't rebuild connectionOptions if no pooling is involved - let new connections do that work if (connectionPoolGroup.IsDisabled && (null != connectionPoolGroup.PoolGroupOptions)) { Bid.Trace("<prov.DbConnectionFactory.GetConnectionPool|RES|INFO|CPOOL> %d#, DisabledPoolGroup=%d#\n", ObjectID, connectionPoolGroup.ObjectID); // reusing existing pool option in case user originally used SetConnectionPoolOptions DbConnectionPoolGroupOptions poolOptions = connectionPoolGroup.PoolGroupOptions; // get the string to hash on again DbConnectionOptions connectionOptions = connectionPoolGroup.ConnectionOptions; Debug.Assert(null != connectionOptions, "prevent expansion of connectionString"); connectionPoolGroup = GetConnectionPoolGroup(connectionPoolGroup.PoolKey, poolOptions, ref connectionOptions); Debug.Assert(null != connectionPoolGroup, "null connectionPoolGroup?"); SetConnectionPoolGroup(owningObject, connectionPoolGroup); } DbConnectionPool connectionPool = connectionPoolGroup.GetConnectionPool(this); return(connectionPool); }
private DbConnectionPool GetConnectionPool(DbConnection owningObject, DbConnectionPoolGroup connectionPoolGroup) { if (connectionPoolGroup.IsDisabled && (connectionPoolGroup.PoolGroupOptions != null)) { Bid.Trace("<prov.DbConnectionFactory.GetConnectionPool|RES|INFO|CPOOL> %d#, DisabledPoolGroup=%d#\n", this.ObjectID, connectionPoolGroup.ObjectID); DbConnectionPoolGroupOptions poolGroupOptions = connectionPoolGroup.PoolGroupOptions; DbConnectionOptions connectionOptions = connectionPoolGroup.ConnectionOptions; string connectionString = connectionOptions.UsersConnectionString(false); connectionPoolGroup = this.GetConnectionPoolGroup(connectionString, poolGroupOptions, ref connectionOptions); this.SetConnectionPoolGroup(owningObject, connectionPoolGroup); } return(connectionPoolGroup.GetConnectionPool(this)); }
private DbConnectionPool GetConnectionPool(DbConnection owningObject, DbConnectionPoolGroup connectionPoolGroup) { // if poolgroup is disabled, it will be replaced with a new entry Debug.Assert(null != owningObject, "null owningObject?"); Debug.Assert(null != connectionPoolGroup, "null connectionPoolGroup?"); // It is possible that while the outer connection object has // been sitting around in a closed and unused state in some long // running app, the pruner may have come along and remove this // the pool entry from the master list. If we were to use a // pool entry in this state, we would create "unmanaged" pools, // which would be bad. To avoid this problem, we automagically // re-create the pool entry whenever it's disabled. // however, don't rebuild connectionOptions if no pooling is involved - let new connections do that work if (connectionPoolGroup.IsDisabled && (null != connectionPoolGroup.PoolGroupOptions)) { // reusing existing pool option in case user originally used SetConnectionPoolOptions DbConnectionPoolGroupOptions poolOptions = connectionPoolGroup.PoolGroupOptions; // get the string to hash on again DbConnectionOptions connectionOptions = connectionPoolGroup.ConnectionOptions; Debug.Assert(null != connectionOptions, "prevent expansion of connectionString"); connectionPoolGroup = GetConnectionPoolGroup(connectionPoolGroup.PoolKey, poolOptions, ref connectionOptions); Debug.Assert(null != connectionPoolGroup, "null connectionPoolGroup?"); SetConnectionPoolGroup(owningObject, connectionPoolGroup); } DbConnectionPool connectionPool = connectionPoolGroup.GetConnectionPool(this); return connectionPool; }
private DbConnectionPool GetConnectionPool(DbConnection owningObject, DbConnectionPoolGroup connectionPoolGroup) { if (connectionPoolGroup.IsDisabled && (connectionPoolGroup.PoolGroupOptions != null)) { Bid.Trace("<prov.DbConnectionFactory.GetConnectionPool|RES|INFO|CPOOL> %d#, DisabledPoolGroup=%d#\n", this.ObjectID, connectionPoolGroup.ObjectID); DbConnectionPoolGroupOptions poolGroupOptions = connectionPoolGroup.PoolGroupOptions; DbConnectionOptions connectionOptions = connectionPoolGroup.ConnectionOptions; string connectionString = connectionOptions.UsersConnectionString(false); connectionPoolGroup = this.GetConnectionPoolGroup(connectionString, poolGroupOptions, ref connectionOptions); this.SetConnectionPoolGroup(owningObject, connectionPoolGroup); } return connectionPoolGroup.GetConnectionPool(this); }