internal DbConnectionPoolGroup(DbConnectionOptions connectionOptions, DbConnectionPoolGroupOptions poolGroupOptions) { this._connectionOptions = connectionOptions; this._poolGroupOptions = poolGroupOptions; this._poolCollection = new HybridDictionary(1, false); this._state = 1; }
internal DbConnectionPoolGroup(DbConnectionOptions connectionOptions, DbConnectionPoolGroupOptions poolGroupOptions) { this._connectionOptions = connectionOptions; this._poolGroupOptions = poolGroupOptions; this._poolCollection = new HybridDictionary(1, false); this._state = 1; }
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); }
protected override System.Data.ProviderBase.DbConnectionPoolGroupOptions CreateConnectionPoolGroupOptions(System.Data.Common.DbConnectionOptions connectionOptions) { OracleConnectionString str = (OracleConnectionString) connectionOptions; System.Data.ProviderBase.DbConnectionPoolGroupOptions options = null; if (str.Pooling) { options = new System.Data.ProviderBase.DbConnectionPoolGroupOptions(str.IntegratedSecurity, str.MinPoolSize, str.MaxPoolSize, 0x7530, str.LoadBalanceTimeout, str.Enlist, false); } return options; }
protected override System.Data.ProviderBase.DbConnectionPoolGroupOptions CreateConnectionPoolGroupOptions(System.Data.Common.DbConnectionOptions connectionOptions) { OracleConnectionString str = (OracleConnectionString)connectionOptions; System.Data.ProviderBase.DbConnectionPoolGroupOptions options = null; if (str.Pooling) { options = new System.Data.ProviderBase.DbConnectionPoolGroupOptions(str.IntegratedSecurity, str.MinPoolSize, str.MaxPoolSize, 0x7530, str.LoadBalanceTimeout, str.Enlist, false); } return(options); }
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 const int PoolGroupStateDisabled = 4; // factory pool entry pruning method internal DbConnectionPoolGroup(DbConnectionOptions connectionOptions, DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolGroupOptions) { Debug.Assert(null != connectionOptions, "null connection options"); _connectionOptions = connectionOptions; _poolKey = key; _poolGroupOptions = poolGroupOptions; // always lock this object before changing state // HybridDictionary does not create any sub-objects until add // so it is safe to use for non-pooled connection as long as // we check _poolGroupOptions first _poolCollection = new ConcurrentDictionary <DbConnectionPoolIdentity, DbConnectionPool>(); _state = PoolGroupStateActive; }
private const int PoolGroupStateDisabled = 4; // factory pool entry prunning method internal DbConnectionPoolGroup (DbConnectionOptions connectionOptions, DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolGroupOptions) { Debug.Assert(null != connectionOptions, "null connection options"); Debug.Assert(null == poolGroupOptions || ADP.IsWindowsNT, "should not have pooling options on Win9x"); _connectionOptions = connectionOptions; _poolKey = key; _poolGroupOptions = poolGroupOptions; // always lock this object before changing state // HybridDictionary does not create any sub-objects until add // so it is safe to use for non-pooled connection as long as // we check _poolGroupOptions first _poolCollection = new ConcurrentDictionary<DbConnectionPoolIdentity, DbConnectionPool>(); _state = PoolGroupStateActive; // VSWhidbey 112102 }
// only created by DbConnectionPoolGroup.GetConnectionPool internal DbConnectionPool( DbConnectionFactory connectionFactory, DbConnectionPoolGroup connectionPoolGroup, DbConnectionPoolIdentity identity, DbConnectionPoolProviderInfo?connectionPoolProviderInfo) { Debug.Assert(null != connectionPoolGroup, "null connectionPoolGroup"); if ((null != identity) && identity.IsRestricted) { throw ADP.InternalError(ADP.InternalErrorCode.AttemptingToPoolOnRestrictedToken); } _state = State.Initializing; lock (s_random) { // Random.Next is not thread-safe _cleanupWait = s_random.Next(12, 24) * 10 * 1000; // 2-4 minutes in 10 sec intervals } _connectionFactory = connectionFactory; _connectionPoolGroup = connectionPoolGroup; _connectionPoolGroupOptions = connectionPoolGroup.PoolGroupOptions; _connectionPoolProviderInfo = connectionPoolProviderInfo; _identity = identity; _waitHandles = new PoolWaitHandles(); _errorWait = ERROR_WAIT_DEFAULT; _errorTimer = null; // No error yet. _objectList = new List <DbConnectionInternal>(MaxPoolSize); _poolCreateRequest = new WaitCallback(PoolCreateRequest); // used by CleanupCallback _state = State.Running; //_cleanupTimer & QueuePoolCreateRequest is delayed until DbConnectionPoolGroup calls // StartBackgroundCallbacks after pool is actually in the collection }
override protected DbConnectionPoolGroupOptions CreateConnectionPoolGroupOptions( DbConnectionOptions connectionOptions ) { SqlConnectionString opt = (SqlConnectionString)connectionOptions; DbConnectionPoolGroupOptions poolingOptions = null; if (!opt.ContextConnection && opt.Pooling) { // never pool context connections. int connectionTimeout = opt.ConnectTimeout; if ((0 < connectionTimeout) && (connectionTimeout < Int32.MaxValue/1000)) connectionTimeout *= 1000; else if (connectionTimeout >= Int32.MaxValue/1000) connectionTimeout = Int32.MaxValue; poolingOptions = new DbConnectionPoolGroupOptions( opt.IntegratedSecurity, opt.MinPoolSize, opt.MaxPoolSize, connectionTimeout, opt.LoadBalanceTimeout, opt.Enlist); } return poolingOptions; }
// only created by DbConnectionPoolGroup.GetConnectionPool internal DbConnectionPool( DbConnectionFactory connectionFactory, DbConnectionPoolGroup connectionPoolGroup, DbConnectionPoolIdentity identity, DbConnectionPoolProviderInfo connectionPoolProviderInfo) { Debug.Assert(null != connectionPoolGroup, "null connectionPoolGroup"); if ((null != identity) && identity.IsRestricted) { throw ADP.InternalError(ADP.InternalErrorCode.AttemptingToPoolOnRestrictedToken); } _state = State.Initializing; lock (s_random) { // Random.Next is not thread-safe _cleanupWait = s_random.Next(12, 24) * 10 * 1000; // 2-4 minutes in 10 sec intervals } _connectionFactory = connectionFactory; _connectionPoolGroup = connectionPoolGroup; _connectionPoolGroupOptions = connectionPoolGroup.PoolGroupOptions; _connectionPoolProviderInfo = connectionPoolProviderInfo; _identity = identity; _waitHandles = new PoolWaitHandles(); _errorWait = ERROR_WAIT_DEFAULT; _errorTimer = null; // No error yet. _objectList = new List<DbConnectionInternal>(MaxPoolSize); _poolCreateRequest = new WaitCallback(PoolCreateRequest); // used by CleanupCallback _state = State.Running; //_cleanupTimer & QueuePoolCreateRequest is delayed until DbConnectionPoolGroup calls // StartBackgroundCallbacks after pool is actually in the collection }
internal DbConnectionPoolGroup GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, ref DbConnectionOptions userConnectionOptions) { if (string.IsNullOrEmpty(key.ConnectionString)) { return((DbConnectionPoolGroup)null); } DbConnectionPoolGroup connectionPoolGroup; Dictionary <DbConnectionPoolKey, DbConnectionPoolGroup> connectionPoolGroups = _connectionPoolGroups; if (!connectionPoolGroups.TryGetValue(key, out connectionPoolGroup) || (connectionPoolGroup.IsDisabled && (null != connectionPoolGroup.PoolGroupOptions))) { // If we can't find an entry for the connection string in // our collection of pool entries, then we need to create a // new pool entry and add it to our collection. DbConnectionOptions connectionOptions = CreateConnectionOptions(key.ConnectionString, userConnectionOptions); if (null == connectionOptions) { throw ADP.InternalConnectionError(ADP.ConnectionError.ConnectionOptionsMissing); } if (null == userConnectionOptions) { // we only allow one expansion on the connection string userConnectionOptions = connectionOptions; } // We don't support connection pooling on Win9x if (null == poolOptions) { if (null != connectionPoolGroup) { // reusing existing pool option in case user originally used SetConnectionPoolOptions poolOptions = connectionPoolGroup.PoolGroupOptions; } else { // Note: may return null for non-pooled connections poolOptions = CreateConnectionPoolGroupOptions(connectionOptions); } } lock (this) { connectionPoolGroups = _connectionPoolGroups; if (!connectionPoolGroups.TryGetValue(key, out connectionPoolGroup)) { DbConnectionPoolGroup newConnectionPoolGroup = new DbConnectionPoolGroup(connectionOptions, key, poolOptions); newConnectionPoolGroup.ProviderInfo = CreateConnectionPoolGroupProviderInfo(connectionOptions); // build new dictionary with space for new connection string Dictionary <DbConnectionPoolKey, DbConnectionPoolGroup> newConnectionPoolGroups = new Dictionary <DbConnectionPoolKey, DbConnectionPoolGroup>(1 + connectionPoolGroups.Count); foreach (KeyValuePair <DbConnectionPoolKey, DbConnectionPoolGroup> entry in connectionPoolGroups) { newConnectionPoolGroups.Add(entry.Key, entry.Value); } // lock prevents race condition with PruneConnectionPoolGroups newConnectionPoolGroups.Add(key, newConnectionPoolGroup); connectionPoolGroup = newConnectionPoolGroup; _connectionPoolGroups = newConnectionPoolGroups; } else { Debug.Assert(!connectionPoolGroup.IsDisabled, "Disabled pool entry discovered"); } } Debug.Assert(null != connectionPoolGroup, "how did we not create a pool entry?"); Debug.Assert(null != userConnectionOptions, "how did we not have user connection options?"); } else if (null == userConnectionOptions) { userConnectionOptions = connectionPoolGroup.ConnectionOptions; } return(connectionPoolGroup); }
internal DbConnectionPoolGroup GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, ref DbConnectionOptions userConnectionOptions) { if (ADP.IsEmpty(key.ConnectionString)) { return (DbConnectionPoolGroup)null; } DbConnectionPoolGroup connectionPoolGroup; Dictionary<DbConnectionPoolKey, DbConnectionPoolGroup> connectionPoolGroups = _connectionPoolGroups; if (!connectionPoolGroups.TryGetValue(key, out connectionPoolGroup) || (connectionPoolGroup.IsDisabled && (null != connectionPoolGroup.PoolGroupOptions))) { // If we can't find an entry for the connection string in // our collection of pool entries, then we need to create a // new pool entry and add it to our collection. DbConnectionOptions connectionOptions = CreateConnectionOptions(key.ConnectionString, userConnectionOptions); if (null == connectionOptions) { throw ADP.InternalConnectionError(ADP.ConnectionError.ConnectionOptionsMissing); } if (null == userConnectionOptions) { // we only allow one expansion on the connection string userConnectionOptions = connectionOptions; } // We don't support connection pooling on Win9x if (null == poolOptions) { if (null != connectionPoolGroup) { // reusing existing pool option in case user originally used SetConnectionPoolOptions poolOptions = connectionPoolGroup.PoolGroupOptions; } else { // Note: may return null for non-pooled connections poolOptions = CreateConnectionPoolGroupOptions(connectionOptions); } } DbConnectionPoolGroup newConnectionPoolGroup = new DbConnectionPoolGroup(connectionOptions, key, poolOptions); newConnectionPoolGroup.ProviderInfo = CreateConnectionPoolGroupProviderInfo(connectionOptions); lock (this) { connectionPoolGroups = _connectionPoolGroups; if (!connectionPoolGroups.TryGetValue(key, out connectionPoolGroup)) { // build new dictionary with space for new connection string Dictionary<DbConnectionPoolKey, DbConnectionPoolGroup> newConnectionPoolGroups = new Dictionary<DbConnectionPoolKey, DbConnectionPoolGroup>(1 + connectionPoolGroups.Count); foreach (KeyValuePair<DbConnectionPoolKey, DbConnectionPoolGroup> entry in connectionPoolGroups) { newConnectionPoolGroups.Add(entry.Key, entry.Value); } // lock prevents race condition with PruneConnectionPoolGroups newConnectionPoolGroups.Add(key, newConnectionPoolGroup); connectionPoolGroup = newConnectionPoolGroup; _connectionPoolGroups = newConnectionPoolGroups; } else { Debug.Assert(!connectionPoolGroup.IsDisabled, "Disabled pool entry discovered"); } } Debug.Assert(null != connectionPoolGroup, "how did we not create a pool entry?"); Debug.Assert(null != userConnectionOptions, "how did we not have user connection options?"); } else if (null == userConnectionOptions) { userConnectionOptions = connectionPoolGroup.ConnectionOptions; } return connectionPoolGroup; }
internal DbConnectionPoolGroup GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, ref DbConnectionOptions userConnectionOptions) { if (ADP.IsEmpty(key.ConnectionString)) { return (DbConnectionPoolGroup)null; } DbConnectionPoolGroup connectionPoolGroup; Dictionary<DbConnectionPoolKey, DbConnectionPoolGroup> connectionPoolGroups = _connectionPoolGroups; if (!connectionPoolGroups.TryGetValue(key, out connectionPoolGroup) || (connectionPoolGroup.IsDisabled && (null != connectionPoolGroup.PoolGroupOptions))) { // If we can't find an entry for the connection string in // our collection of pool entries, then we need to create a // new pool entry and add it to our collection. DbConnectionOptions connectionOptions = CreateConnectionOptions(key.ConnectionString, userConnectionOptions); if (null == connectionOptions) { throw ADP.InternalConnectionError(ADP.ConnectionError.ConnectionOptionsMissing); } string expandedConnectionString = key.ConnectionString; if (null == userConnectionOptions) { // we only allow one expansion on the connection string userConnectionOptions = connectionOptions; expandedConnectionString = connectionOptions.Expand(); // if the expanded string is same instance (default implementation), the use the already created options if ((object)expandedConnectionString != (object)key.ConnectionString) { // DbConnectionPoolKey newKey = (DbConnectionPoolKey) ((ICloneable) key).Clone(); newKey.ConnectionString = expandedConnectionString; return GetConnectionPoolGroup(newKey, null, ref userConnectionOptions); } } // We don't support connection pooling on Win9x; it lacks too many of the APIs we require. if ((null == poolOptions) && ADP.IsWindowsNT) { if (null != connectionPoolGroup) { // reusing existing pool option in case user originally used SetConnectionPoolOptions poolOptions = connectionPoolGroup.PoolGroupOptions; } else { // Note: may return null for non-pooled connections poolOptions = CreateConnectionPoolGroupOptions(connectionOptions); } } DbConnectionPoolGroup newConnectionPoolGroup = new DbConnectionPoolGroup(connectionOptions, key, poolOptions); newConnectionPoolGroup.ProviderInfo = CreateConnectionPoolGroupProviderInfo(connectionOptions); lock (this) { connectionPoolGroups = _connectionPoolGroups; if (!connectionPoolGroups.TryGetValue(key, out connectionPoolGroup)) { // build new dictionary with space for new connection string Dictionary<DbConnectionPoolKey, DbConnectionPoolGroup> newConnectionPoolGroups = new Dictionary<DbConnectionPoolKey, DbConnectionPoolGroup>(1+connectionPoolGroups.Count); foreach (KeyValuePair<DbConnectionPoolKey, DbConnectionPoolGroup> entry in connectionPoolGroups) { newConnectionPoolGroups.Add(entry.Key, entry.Value); } // lock prevents race condition with PruneConnectionPoolGroups newConnectionPoolGroups.Add(key, newConnectionPoolGroup); PerformanceCounters.NumberOfActiveConnectionPoolGroups.Increment(); connectionPoolGroup = newConnectionPoolGroup; _connectionPoolGroups = newConnectionPoolGroups; } else { Debug.Assert(!connectionPoolGroup.IsDisabled, "Disabled pool entry discovered"); } } Debug.Assert(null != connectionPoolGroup, "how did we not create a pool entry?"); Debug.Assert(null != userConnectionOptions, "how did we not have user connection options?"); } else if (null == userConnectionOptions) { userConnectionOptions = connectionPoolGroup.ConnectionOptions; } return connectionPoolGroup; }
internal DbConnectionPoolGroup GetConnectionPoolGroup(string connectionString, DbConnectionPoolGroupOptions poolOptions, ref DbConnectionOptions userConnectionOptions) { DbConnectionPoolGroup group; if (ADP.IsEmpty(connectionString)) { return(null); } if (!this._connectionPoolGroups.TryGetValue(connectionString, out group) || (group.IsDisabled && (group.PoolGroupOptions != null))) { DbConnectionOptions options = this.CreateConnectionOptions(connectionString, userConnectionOptions); if (options == null) { throw ADP.InternalConnectionError(ADP.ConnectionError.ConnectionOptionsMissing); } string str = connectionString; if (userConnectionOptions == null) { userConnectionOptions = options; str = options.Expand(); if (str != connectionString) { return(this.GetConnectionPoolGroup(str, null, ref userConnectionOptions)); } } if ((poolOptions == null) && ADP.IsWindowsNT) { if (group != null) { poolOptions = group.PoolGroupOptions; } else { poolOptions = this.CreateConnectionPoolGroupOptions(options); } } DbConnectionPoolGroup group2 = new DbConnectionPoolGroup(options, poolOptions) { ProviderInfo = this.CreateConnectionPoolGroupProviderInfo(options) }; lock (this) { Dictionary <string, DbConnectionPoolGroup> dictionary = this._connectionPoolGroups; if (!dictionary.TryGetValue(str, out group)) { Dictionary <string, DbConnectionPoolGroup> dictionary2 = new Dictionary <string, DbConnectionPoolGroup>(1 + dictionary.Count); foreach (KeyValuePair <string, DbConnectionPoolGroup> pair in dictionary) { dictionary2.Add(pair.Key, pair.Value); } dictionary2.Add(str, group2); this.PerformanceCounters.NumberOfActiveConnectionPoolGroups.Increment(); group = group2; this._connectionPoolGroups = dictionary2; } return(group); } } if (userConnectionOptions == null) { userConnectionOptions = group.ConnectionOptions; } return(group); }
internal DbConnectionPoolGroup GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, ref DbConnectionOptions userConnectionOptions) { if (ADP.IsEmpty(key.ConnectionString)) { return((DbConnectionPoolGroup)null); } DbConnectionPoolGroup connectionPoolGroup; Dictionary <DbConnectionPoolKey, DbConnectionPoolGroup> connectionPoolGroups = _connectionPoolGroups; if (!connectionPoolGroups.TryGetValue(key, out connectionPoolGroup) || (connectionPoolGroup.IsDisabled && (null != connectionPoolGroup.PoolGroupOptions))) { // If we can't find an entry for the connection string in // our collection of pool entries, then we need to create a // new pool entry and add it to our collection. DbConnectionOptions connectionOptions = CreateConnectionOptions(key.ConnectionString, userConnectionOptions); if (null == connectionOptions) { throw ADP.InternalConnectionError(ADP.ConnectionError.ConnectionOptionsMissing); } string expandedConnectionString = key.ConnectionString; if (null == userConnectionOptions) // we only allow one expansion on the connection string { userConnectionOptions = connectionOptions; expandedConnectionString = connectionOptions.Expand(); // if the expanded string is same instance (default implementation), the use the already created options if ((object)expandedConnectionString != (object)key.ConnectionString) { // DbConnectionPoolKey newKey = (DbConnectionPoolKey)((ICloneable)key).Clone(); newKey.ConnectionString = expandedConnectionString; return(GetConnectionPoolGroup(newKey, null, ref userConnectionOptions)); } } // We don't support connection pooling on Win9x; it lacks too many of the APIs we require. if ((null == poolOptions) && ADP.IsWindowsNT) { if (null != connectionPoolGroup) { // reusing existing pool option in case user originally used SetConnectionPoolOptions poolOptions = connectionPoolGroup.PoolGroupOptions; } else { // Note: may return null for non-pooled connections poolOptions = CreateConnectionPoolGroupOptions(connectionOptions); } } DbConnectionPoolGroup newConnectionPoolGroup = new DbConnectionPoolGroup(connectionOptions, key, poolOptions); newConnectionPoolGroup.ProviderInfo = CreateConnectionPoolGroupProviderInfo(connectionOptions); lock (this) { connectionPoolGroups = _connectionPoolGroups; if (!connectionPoolGroups.TryGetValue(key, out connectionPoolGroup)) { // build new dictionary with space for new connection string Dictionary <DbConnectionPoolKey, DbConnectionPoolGroup> newConnectionPoolGroups = new Dictionary <DbConnectionPoolKey, DbConnectionPoolGroup>(1 + connectionPoolGroups.Count); foreach (KeyValuePair <DbConnectionPoolKey, DbConnectionPoolGroup> entry in connectionPoolGroups) { newConnectionPoolGroups.Add(entry.Key, entry.Value); } // lock prevents race condition with PruneConnectionPoolGroups newConnectionPoolGroups.Add(key, newConnectionPoolGroup); PerformanceCounters.NumberOfActiveConnectionPoolGroups.Increment(); connectionPoolGroup = newConnectionPoolGroup; _connectionPoolGroups = newConnectionPoolGroups; } else { Debug.Assert(!connectionPoolGroup.IsDisabled, "Disabled pool entry discovered"); } } Debug.Assert(null != connectionPoolGroup, "how did we not create a pool entry?"); Debug.Assert(null != userConnectionOptions, "how did we not have user connection options?"); } else if (null == userConnectionOptions) { userConnectionOptions = connectionPoolGroup.ConnectionOptions; } return(connectionPoolGroup); }
internal DbConnectionPoolGroup GetConnectionPoolGroup(string connectionString, DbConnectionPoolGroupOptions poolOptions, ref DbConnectionOptions userConnectionOptions) { DbConnectionPoolGroup group; if (ADP.IsEmpty(connectionString)) { return null; } if (!this._connectionPoolGroups.TryGetValue(connectionString, out group) || (group.IsDisabled && (group.PoolGroupOptions != null))) { DbConnectionOptions options = this.CreateConnectionOptions(connectionString, userConnectionOptions); if (options == null) { throw ADP.InternalConnectionError(ADP.ConnectionError.ConnectionOptionsMissing); } string str = connectionString; if (userConnectionOptions == null) { userConnectionOptions = options; str = options.Expand(); if (str != connectionString) { return this.GetConnectionPoolGroup(str, null, ref userConnectionOptions); } } if ((poolOptions == null) && ADP.IsWindowsNT) { if (group != null) { poolOptions = group.PoolGroupOptions; } else { poolOptions = this.CreateConnectionPoolGroupOptions(options); } } DbConnectionPoolGroup group2 = new DbConnectionPoolGroup(options, poolOptions) { ProviderInfo = this.CreateConnectionPoolGroupProviderInfo(options) }; lock (this) { Dictionary<string, DbConnectionPoolGroup> dictionary = this._connectionPoolGroups; if (!dictionary.TryGetValue(str, out group)) { Dictionary<string, DbConnectionPoolGroup> dictionary2 = new Dictionary<string, DbConnectionPoolGroup>(1 + dictionary.Count); foreach (KeyValuePair<string, DbConnectionPoolGroup> pair in dictionary) { dictionary2.Add(pair.Key, pair.Value); } dictionary2.Add(str, group2); this.PerformanceCounters.NumberOfActiveConnectionPoolGroups.Increment(); group = group2; this._connectionPoolGroups = dictionary2; } return group; } } if (userConnectionOptions == null) { userConnectionOptions = group.ConnectionOptions; } return group; }