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
connectionDbConnectionThe 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
connectionis null.
Using(DbTransaction)
Reads the query inside a transaction the caller owns.
public MappedQuery<T> Using(DbTransaction transaction)
Parameters
transactionDbTransactionThe 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
transactionis 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
poolIDbConnectionPool<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
TConnectionThe connection type.
Exceptions
- ArgumentNullException
poolis 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
factoryIDbConnectionFactory<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
TConnectionThe connection type.
Exceptions
- ArgumentNullException
factoryis null.