Table of Contents

Method Using

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

Using(DbConnection)

Reads the query on a connection the caller owns.

public MappedQuery<T> Using(DbConnection connection)

Parameters

connection DbConnection

The connection. It is opened if it is not open, and closed again if the query opened it.

Returns

MappedQuery<T>

The mapped query, to be read with a terminal.

Exceptions

ArgumentNullException

connection is null.

Using(DbTransaction)

Reads the query inside a transaction the caller owns.

public MappedQuery<T> Using(DbTransaction transaction)

Parameters

transaction DbTransaction

The transaction. Its connection must be open when a terminal runs; it is used and left open.

Returns

MappedQuery<T>

The mapped query, to be read with a terminal.

Exceptions

ArgumentNullException

transaction is null.

Using<TConnection>(IDbConnectionPool<TConnection>)

Reads the query on a connection taken from a pool.

public MappedQuery<T> Using<TConnection>(IDbConnectionPool<TConnection> pool) where TConnection : DbConnection

Parameters

pool IDbConnectionPool<TConnection>

The pool. A connection is taken for the call and given back when it ends.

Returns

MappedQuery<T>

The mapped query, to be read with a terminal.

Type Parameters

TConnection

The connection type.

Exceptions

ArgumentNullException

pool is null.

Using<TConnection>(IDbConnectionFactory<TConnection>)

Reads the query on a connection made by a factory.

public MappedQuery<T> Using<TConnection>(IDbConnectionFactory<TConnection> factory) where TConnection : DbConnection

Parameters

factory IDbConnectionFactory<TConnection>

The factory. A connection is made for the call and disposed when it ends.

Returns

MappedQuery<T>

The mapped query, to be read with a terminal.

Type Parameters

TConnection

The connection type.

Exceptions

ArgumentNullException

factory is null.