Table of Contents

Method AsPool

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

AsPool(IDbConnectionFactory)

Presents a connection factory as a connection pool that creates a new connection when one is taken and disposes it when it is given back.

public static DbConnectionFactoryExtensions.ConnectionFactoryToPoolAdapter AsPool(this IDbConnectionFactory connectionFactory)

Parameters

connectionFactory IDbConnectionFactory

The connection factory to generate connections from.

Returns

DbConnectionFactoryExtensions.ConnectionFactoryToPoolAdapter

A DbConnectionFactoryExtensions.ConnectionFactoryToPoolAdapter that handles this factory.

Remarks

This is the "get in, get out" model: every command execution creates its own connection, opens it only if needed, and disposes it when the command is finished.

AsPool(Func<IDbConnection>)

Presents a connection factory function as a connection pool that invokes the function when a connection is taken and disposes the connection when it is given back.

public static DbConnectionFactoryExtensions.ConnectionFactoryToPoolAdapter AsPool(this Func<IDbConnection> connectionFactory)

Parameters

connectionFactory Func<IDbConnection>

The function that creates a connection.

Returns

DbConnectionFactoryExtensions.ConnectionFactoryToPoolAdapter

A DbConnectionFactoryExtensions.ConnectionFactoryToPoolAdapter that handles this function.

Remarks

This is the "get in, get out" model: every command execution creates its own connection, opens it only if needed, and disposes it when the command is finished.

AsPool<TConnection>(IDbConnectionFactory<TConnection>)

Presents a typed connection factory as a connection pool that creates a new connection when one is taken and disposes it when it is given back.

public static DbConnectionFactoryExtensions.ConnectionFactoryToPoolAdapter<TConnection> AsPool<TConnection>(this IDbConnectionFactory<TConnection> connectionFactory) where TConnection : IDbConnection

Parameters

connectionFactory IDbConnectionFactory<TConnection>

The connection factory to generate connections from.

Returns

DbConnectionFactoryExtensions.ConnectionFactoryToPoolAdapter<TConnection>

A DbConnectionFactoryExtensions.ConnectionFactoryToPoolAdapter<TConnection> that handles this factory.

Type Parameters

TConnection

The connection type.

Remarks

This is the "get in, get out" model: every command execution creates its own connection, opens it only if needed, and disposes it when the command is finished.

AsPool<TConnection>(Func<TConnection>)

Presents a typed connection factory function as a connection pool that invokes the function when a connection is taken and disposes the connection when it is given back.

public static DbConnectionFactoryExtensions.ConnectionFactoryToPoolAdapter<TConnection> AsPool<TConnection>(this Func<TConnection> connectionFactory) where TConnection : IDbConnection

Parameters

connectionFactory Func<TConnection>

The function that creates a connection.

Returns

DbConnectionFactoryExtensions.ConnectionFactoryToPoolAdapter<TConnection>

A DbConnectionFactoryExtensions.ConnectionFactoryToPoolAdapter<TConnection> that handles this function.

Type Parameters

TConnection

The connection type.

Remarks

This is the "get in, get out" model: every command execution creates its own connection, opens it only if needed, and disposes it when the command is finished.