public Connection this[ConnectionIdentifier id] { get { lock (ConnectionPool._pool) { return ConnectionPool._pool[id]; } } set { lock (ConnectionPool._pool) { ConnectionPool._pool[id] = value; } } }
/// <summary> /// See if the connection with the name exists in the pool. /// </summary> public bool Contains(ConnectionIdentifier identifier) { lock (ConnectionPool._pool) { return ConnectionPool._pool.ContainsKey(identifier); } }
/// <summary> /// Removes the connection from the Pool. /// </summary> public void Remove(Connection conn) { lock (ConnectionPool._pool) { ConnectionIdentifier id = new ConnectionIdentifier(Thread.CurrentThread.ManagedThreadId, conn.UniqueConnectionName); if(_pool.ContainsKey(id)) { ConnectionPool._pool.Remove(id); } else { throw new Exception("Could not find a connection in the ConnectionPool, Name = " + conn.UniqueConnectionName + " ConnectionString: " + conn.ConnectionString); } } }
/// <summary> /// See if the connection with the name exists in the pool. /// </summary> public bool Contains(string name, int threadID) { ConnectionIdentifier id = new ConnectionIdentifier(threadID, name); return Contains(id); }