Example #1
0
 public Connection this[ConnectionIdentifier id]
 {
     get
     {
         lock (ConnectionPool._pool)
         {
             return ConnectionPool._pool[id];
         }
     }
     set
     {
         lock (ConnectionPool._pool)
         {
             ConnectionPool._pool[id] = value;
         }
     }
 }
Example #2
0
 /// <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);
     }
 }
Example #3
0
 /// <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);
         }
     }
 }
Example #4
0
 /// <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);
 }