Table of Contents

Interface IDbConnectionPool

Namespace
Open.Database.Extensions
Assembly
Open.Database.Extensions.Core.dll

A common abstraction for acquiring and releasing database connections. Can easily be used with dependency injection.

public interface IDbConnectionPool
Extension Methods

Remarks

Every Take() is paired with exactly one Give(IDbConnection). The expressive commands (for example ExpressiveCommand) call Give(IDbConnection) in a finally block, so a connection is handed back even when the command fails.

Implementations decide what giving a connection back means. A pool that hosts a single connection for non-concurrent operations returns the connection to the state it was in when it was taken (a connection that was closed is closed again). A connection factory can pose as a pool through AsPool(IDbConnectionFactory), in which case taking always creates a new connection and giving back always disposes it.

Methods

Give(IDbConnection)

Gives a connection back to the pool.

Take()

Provides a connection that is ready to be handed to a command.

See Also