internal System.Data.ProviderBase.DbConnectionPool GetConnectionPool(System.Data.ProviderBase.DbConnectionFactory connectionFactory) { object obj2 = null; if (this._poolGroupOptions != null) { System.Data.ProviderBase.DbConnectionPoolIdentity noIdentity = System.Data.ProviderBase.DbConnectionPoolIdentity.NoIdentity; if (this._poolGroupOptions.PoolByIdentity) { noIdentity = System.Data.ProviderBase.DbConnectionPoolIdentity.GetCurrent(); if (noIdentity.IsRestricted) { noIdentity = null; } } if (noIdentity != null) { obj2 = this._poolCollection[noIdentity]; if (obj2 == null) { System.Data.ProviderBase.DbConnectionPoolProviderInfo connectionPoolProviderInfo = connectionFactory.CreateConnectionPoolProviderInfo(this.ConnectionOptions); System.Data.ProviderBase.DbConnectionPool pool = new System.Data.ProviderBase.DbConnectionPool(connectionFactory, this, noIdentity, connectionPoolProviderInfo); lock (this) { HybridDictionary dictionary = this._poolCollection; obj2 = dictionary[noIdentity]; if ((obj2 == null) && this.MarkPoolGroupAsActive()) { pool.Startup(); HybridDictionary dictionary2 = new HybridDictionary(1 + dictionary.Count, false); foreach (DictionaryEntry entry in dictionary) { dictionary2.Add(entry.Key, entry.Value); } dictionary2.Add(noIdentity, pool); connectionFactory.PerformanceCounters.NumberOfActiveConnectionPools.Increment(); this._poolCollection = dictionary2; this._poolCount = dictionary2.Count; obj2 = pool; pool = null; } } if (pool != null) { pool.Shutdown(); } } } } if (obj2 == null) { lock (this) { this.MarkPoolGroupAsActive(); } } return((System.Data.ProviderBase.DbConnectionPool)obj2); }
internal void QueuePoolForRelease(System.Data.ProviderBase.DbConnectionPool pool, bool clearing) { pool.Shutdown(); lock (this._poolsToRelease) { if (clearing) { pool.Clear(); } this._poolsToRelease.Add(pool); } this.PerformanceCounters.NumberOfInactiveConnectionPools.Increment(); }
internal System.Data.ProviderBase.DbConnectionPool GetConnectionPool(System.Data.ProviderBase.DbConnectionFactory connectionFactory) { object obj2 = null; if (this._poolGroupOptions != null) { System.Data.ProviderBase.DbConnectionPoolIdentity noIdentity = System.Data.ProviderBase.DbConnectionPoolIdentity.NoIdentity; if (this._poolGroupOptions.PoolByIdentity) { noIdentity = System.Data.ProviderBase.DbConnectionPoolIdentity.GetCurrent(); if (noIdentity.IsRestricted) { noIdentity = null; } } if (noIdentity != null) { obj2 = this._poolCollection[noIdentity]; if (obj2 == null) { System.Data.ProviderBase.DbConnectionPoolProviderInfo connectionPoolProviderInfo = connectionFactory.CreateConnectionPoolProviderInfo(this.ConnectionOptions); System.Data.ProviderBase.DbConnectionPool pool = new System.Data.ProviderBase.DbConnectionPool(connectionFactory, this, noIdentity, connectionPoolProviderInfo); lock (this) { HybridDictionary dictionary = this._poolCollection; obj2 = dictionary[noIdentity]; if ((obj2 == null) && this.MarkPoolGroupAsActive()) { pool.Startup(); HybridDictionary dictionary2 = new HybridDictionary(1 + dictionary.Count, false); foreach (DictionaryEntry entry in dictionary) { dictionary2.Add(entry.Key, entry.Value); } dictionary2.Add(noIdentity, pool); connectionFactory.PerformanceCounters.NumberOfActiveConnectionPools.Increment(); this._poolCollection = dictionary2; this._poolCount = dictionary2.Count; obj2 = pool; pool = null; } } if (pool != null) { pool.Shutdown(); } } } } if (obj2 == null) { lock (this) { this.MarkPoolGroupAsActive(); } } return (System.Data.ProviderBase.DbConnectionPool) obj2; }