Dispose() public method

public Dispose ( ) : void
return void
Esempio n. 1
0
        internal static void ReturnConnection(Connection connection)
        {
            lock (_syncRoot)
            {
                if (_databasePools.Exists(db => db.Alias == connection.Alias) && connection.IsReusable)
                {
                    DatabasePool pool = _databasePools.Find(q => q.Alias == connection.Alias);

                    pool.EnqueueConnection(connection);
                }
                else
                {
                    connection.Dispose();
                }
            }
        }
Esempio n. 2
0
        internal static void ReturnConnection(Connection connection)
        {
            lock (_syncRoot)
            {
                DatabasePool pool = _databasePools.Find(q => q.Alias == connection.Alias);

                // enqueue the connection back if it's active, reusable and the pool size is not full
                // otherwise dispose it
                if ((pool != null) && 
                    (pool.CurrentSize < pool.PoolSize) &&
                    connection.IsActive &&
                    connection.IsReusable)
                {
                    pool.EnqueueConnection(connection);
                }
                else
                {
                    connection.Dispose();
                }
            }
        }