Example #1
0
 /// <summary>
 /// Performs the initialization of a <see cref="PooledDbConnection"/> as it is grabbed from the object pool.
 /// </summary>
 /// <param name="conn">The <see cref="PooledDbConnection"/> to initialize.</param>
 protected virtual void InitializePooledConnection(PooledDbConnection conn)
 {
     if (conn.Connection.State != ConnectionState.Open)
     {
         conn.Connection.Open();
     }
 }
Example #2
0
 /// <summary>
 /// Creates a new <see cref="PooledDbConnection"/> for the <see cref="_pool"/>.
 /// </summary>
 /// <param name="objectPool">The owner object pool.</param>
 /// <returns>A new <see cref="PooledDbConnection"/> for the <see cref="_pool"/>.</returns>
 PooledDbConnection CreateNewObj(IObjectPool<PooledDbConnection> objectPool)
 {
     var ret = new PooledDbConnection(this);
     var conn = CreateConnection(ConnectionString);
     ret.SetConnection(conn);
     return ret;
 }
Example #3
0
        /// <summary>
        /// Creates a new <see cref="PooledDbConnection"/> for the <see cref="_pool"/>.
        /// </summary>
        /// <param name="objectPool">The owner object pool.</param>
        /// <returns>A new <see cref="PooledDbConnection"/> for the <see cref="_pool"/>.</returns>
        PooledDbConnection CreateNewObj(IObjectPool <PooledDbConnection> objectPool)
        {
            var ret  = new PooledDbConnection(this);
            var conn = CreateConnection(ConnectionString);

            ret.SetConnection(conn);
            return(ret);
        }
Example #4
0
 /// <summary>
 /// Performs the deinitialization of a <see cref="PooledDbConnection"/> as it is released back into the object pool.
 /// </summary>
 /// <param name="conn">The <see cref="PooledDbConnection"/> to deinitialize.</param>
 protected virtual void DeinitializePooledConnection(PooledDbConnection conn)
 {
     conn.Connection.Close();
 }
Example #5
0
 /// <summary>
 /// Frees the object so the pool can reuse it. After freeing an object, it should not be used
 /// in any way, and be treated like it has been disposed.
 /// </summary>
 /// <param name="poolObject">The object to be freed.</param>
 /// <param name="throwArgumentException">Whether or not an <see cref="ArgumentException"/> will be thrown for
 /// objects that do not belong to this pool.</param>
 /// <exception cref="ArgumentException"><paramref name="throwArgumentException"/> is tru and the
 /// <paramref name="poolObject"/> does not belong to this pool.</exception>
 /// <exception cref="ArgumentNullException"><paramref name="poolObject"/> is null.</exception>
 public void Free(PooledDbConnection poolObject, bool throwArgumentException)
 {
     _pool.Free(poolObject, throwArgumentException);
 }
Example #6
0
 /// <summary>
 /// Frees the object so the pool can reuse it. After freeing an object, it should not be used
 /// in any way, and be treated like it has been disposed. No exceptions will be thrown for trying to free
 /// an object that does not belong to this pool.
 /// </summary>
 /// <param name="poolObject">The object to be freed.</param>
 /// <exception cref="ArgumentNullException"><paramref name="poolObject"/> is null.</exception>
 public void Free(PooledDbConnection poolObject)
 {
     _pool.Free(poolObject);
 }
Example #7
0
 /// <summary>
 /// Performs the initialization of a <see cref="PooledDbConnection"/> as it is grabbed from the object pool.
 /// </summary>
 /// <param name="conn">The <see cref="PooledDbConnection"/> to initialize.</param>
 protected virtual void InitializePooledConnection(PooledDbConnection conn)
 {
     if (conn.Connection.State != ConnectionState.Open)
         conn.Connection.Open();
 }
Example #8
0
 /// <summary>
 /// Performs the deinitialization of a <see cref="PooledDbConnection"/> as it is released back into the object pool.
 /// </summary>
 /// <param name="conn">The <see cref="PooledDbConnection"/> to deinitialize.</param>
 protected virtual void DeinitializePooledConnection(PooledDbConnection conn)
 {
     conn.Connection.Close();
 }
Example #9
0
 /// <summary>
 /// Frees the object so the pool can reuse it. After freeing an object, it should not be used
 /// in any way, and be treated like it has been disposed.
 /// </summary>
 /// <param name="poolObject">The object to be freed.</param>
 /// <param name="throwArgumentException">Whether or not an <see cref="ArgumentException"/> will be thrown for
 /// objects that do not belong to this pool.</param>
 /// <exception cref="ArgumentException"><paramref name="throwArgumentException"/> is tru and the 
 /// <paramref name="poolObject"/> does not belong to this pool.</exception>
 /// <exception cref="ArgumentNullException"><paramref name="poolObject"/> is null.</exception>
 public void Free(PooledDbConnection poolObject, bool throwArgumentException)
 {
     _pool.Free(poolObject, throwArgumentException);
 }
Example #10
0
 /// <summary>
 /// Frees the object so the pool can reuse it. After freeing an object, it should not be used
 /// in any way, and be treated like it has been disposed. No exceptions will be thrown for trying to free
 /// an object that does not belong to this pool.
 /// </summary>
 /// <param name="poolObject">The object to be freed.</param>
 /// <exception cref="ArgumentNullException"><paramref name="poolObject"/> is null.</exception>
 public void Free(PooledDbConnection poolObject)
 {
     _pool.Free(poolObject);
 }