Class SqlStatementObjectExtensions
- Namespace
- LfrlAnvil.Sql.Statements
- Assembly
- LfrlAnvil.Sql.Core.dll
Contains various extension methods related to SQL statements.
public static class SqlStatementObjectExtensions
- Inheritance
-
SqlStatementObjectExtensions
- Inherited Members
Methods
BeginTransactionAsync(IDbConnection, IsolationLevel, CancellationToken)
Asynchronously creates a new DbTransaction instance from the provided connection.
[Pure]
public static ValueTask<DbTransaction> BeginTransactionAsync(this IDbConnection connection, IsolationLevel isolationLevel, CancellationToken cancellationToken = default)
Parameters
connectionIDbConnectionSource connection.
isolationLevelIsolationLevelTransaction's IsolationLevel.
cancellationTokenCancellationTokenOptional CancellationToken.
Returns
- ValueTask<DbTransaction>
ValueTask<TResult> that returns a new DbTransaction instance.
Bind(SqlParameterBinder, IEnumerable<SqlParameter>?)
Binds the provided SqlParameterBinder to the given parameter source.
[Pure]
public static SqlParameterBinderExecutor Bind(this SqlParameterBinder binder, IEnumerable<SqlParameter>? source)
Parameters
binderSqlParameterBinderSource parameter binder.
sourceIEnumerable<SqlParameter>Parameter source to bind with.
Returns
- SqlParameterBinderExecutor
New SqlParameterBinderExecutor instance.
BindStatement(SqlAsyncQueryReader, string)
Binds the provided SqlAsyncQueryReader to the given sql statement.
[Pure]
public static SqlAsyncQueryReaderExecutor BindStatement(this SqlAsyncQueryReader reader, string sql)
Parameters
readerSqlAsyncQueryReaderSource query reader.
sqlstringSQL statement to bind with.
Returns
- SqlAsyncQueryReaderExecutor
New SqlAsyncQueryReaderExecutor instance.
BindStatement(SqlAsyncScalarQueryReader, string)
Binds the provided SqlAsyncScalarQueryReader to the given sql statement.
[Pure]
public static SqlAsyncScalarQueryReaderExecutor BindStatement(this SqlAsyncScalarQueryReader reader, string sql)
Parameters
readerSqlAsyncScalarQueryReaderSource scalar query reader.
sqlstringSQL statement to bind with.
Returns
BindStatement(SqlParameterBinder, string)
Binds the provided SqlParameterBinder to the given parameter sql statement.
[Pure]
public static SqlParameterizedStatementExecutor BindStatement(this SqlParameterBinder binder, string sql)
Parameters
binderSqlParameterBinderSource parameter binder.
sqlstringSQL statement to bind with.
Returns
BindStatement(SqlQueryReader, string)
Binds the provided SqlQueryReader to the given sql statement.
[Pure]
public static SqlQueryReaderExecutor BindStatement(this SqlQueryReader reader, string sql)
Parameters
readerSqlQueryReaderSource query reader.
sqlstringSQL statement to bind with.
Returns
- SqlQueryReaderExecutor
New SqlQueryReaderExecutor instance.
BindStatement(SqlScalarQueryReader, string)
Binds the provided SqlScalarQueryReader to the given sql statement.
[Pure]
public static SqlScalarQueryReaderExecutor BindStatement(this SqlScalarQueryReader reader, string sql)
Parameters
readerSqlScalarQueryReaderSource scalar query reader.
sqlstringSQL statement to bind with.
Returns
- SqlScalarQueryReaderExecutor
New SqlScalarQueryReaderExecutor instance.
BindStatement<TRow>(SqlAsyncQueryReader<TRow>, string)
Binds the provided SqlAsyncQueryReader<TRow> to the given sql statement.
[Pure]
public static SqlAsyncQueryReaderExecutor<TRow> BindStatement<TRow>(this SqlAsyncQueryReader<TRow> reader, string sql) where TRow : notnull
Parameters
readerSqlAsyncQueryReader<TRow>Source query reader.
sqlstringSQL statement to bind with.
Returns
- SqlAsyncQueryReaderExecutor<TRow>
New SqlAsyncQueryReaderExecutor<TRow> instance.
Type Parameters
TRowRow type.
BindStatement<T>(SqlAsyncScalarQueryReader<T>, string)
Binds the provided SqlAsyncScalarQueryReader<T> to the given sql statement.
[Pure]
public static SqlAsyncScalarQueryReaderExecutor<T> BindStatement<T>(this SqlAsyncScalarQueryReader<T> reader, string sql)
Parameters
readerSqlAsyncScalarQueryReader<T>Source scalar query reader.
sqlstringSQL statement to bind with.
Returns
- SqlAsyncScalarQueryReaderExecutor<T>
New SqlAsyncScalarQueryReaderExecutor<T> instance.
Type Parameters
TValue type.
BindStatement<T>(SqlParameterBinder<T>, string)
Binds the provided SqlParameterBinder<TSource> to the given parameter sql statement.
[Pure]
public static SqlParameterizedStatementExecutor<T> BindStatement<T>(this SqlParameterBinder<T> binder, string sql) where T : notnull
Parameters
binderSqlParameterBinder<T>Source parameter binder.
sqlstringSQL statement to bind with.
Returns
- SqlParameterizedStatementExecutor<T>
New SqlParameterizedStatementExecutor<T> instance.
Type Parameters
TParameter source type.
BindStatement<TRow>(SqlQueryReader<TRow>, string)
Binds the provided SqlQueryReader<TRow> to the given sql statement.
[Pure]
public static SqlQueryReaderExecutor<TRow> BindStatement<TRow>(this SqlQueryReader<TRow> reader, string sql) where TRow : notnull
Parameters
readerSqlQueryReader<TRow>Source query reader.
sqlstringSQL statement to bind with.
Returns
- SqlQueryReaderExecutor<TRow>
New SqlQueryReaderExecutor<TRow> instance.
Type Parameters
TRowRow type.
BindStatement<T>(SqlScalarQueryReader<T>, string)
Binds the provided SqlScalarQueryReader<T> to the given sql statement.
[Pure]
public static SqlScalarQueryReaderExecutor<T> BindStatement<T>(this SqlScalarQueryReader<T> reader, string sql)
Parameters
readerSqlScalarQueryReader<T>Source scalar query reader.
sqlstringSQL statement to bind with.
Returns
- SqlScalarQueryReaderExecutor<T>
New SqlScalarQueryReaderExecutor<T> instance.
Type Parameters
TValue type.
Bind<TSource>(SqlParameterBinder<TSource>, TSource?)
Binds the provided SqlParameterBinder<TSource> to the given parameter source.
[Pure]
public static SqlParameterBinderExecutor<TSource> Bind<TSource>(this SqlParameterBinder<TSource> binder, TSource? source) where TSource : notnull
Parameters
binderSqlParameterBinder<TSource>Source parameter binder.
sourceTSourceParameter source to bind with.
Returns
- SqlParameterBinderExecutor<TSource>
New SqlParameterBinderExecutor<TSource> instance.
Type Parameters
TSourceParameter source type.
CreateCommand(DbTransaction)
Creates a new DbCommand instance associated with the provided transaction.
public static DbCommand CreateCommand(this DbTransaction transaction)
Parameters
transactionDbTransactionSource transaction.
Returns
CreateCommand(IDbTransaction)
Creates a new IDbCommand instance associated with the provided transaction.
public static IDbCommand CreateCommand(this IDbTransaction transaction)
Parameters
transactionIDbTransactionSource transaction.
Returns
- IDbCommand
New IDbCommand instance.
Execute(IDbCommand)
Executes the provided command.
public static int Execute(this IDbCommand command)
Parameters
commandIDbCommandSource command.
Returns
- int
The number of rows affected.
ExecuteAsync(IDbCommand, CancellationToken)
Asynchronously executes the provided command.
public static ValueTask<int> ExecuteAsync(this IDbCommand command, CancellationToken cancellationToken = default)
Parameters
commandIDbCommandSource command.
cancellationTokenCancellationTokenOptional CancellationToken.
Returns
- ValueTask<int>
ValueTask<TResult> that returns the number of rows affected.
Multi(IDataReader)
Creates a new SqlMultiDataReader instance.
[Pure]
public static SqlMultiDataReader Multi(this IDataReader reader)
Parameters
readerIDataReaderSource data reader.
Returns
- SqlMultiDataReader
New SqlMultiDataReader instance.
MultiAsync(IDataReader)
Creates a new SqlAsyncMultiDataReader instance.
[Pure]
public static SqlAsyncMultiDataReader MultiAsync(this IDataReader reader)
Parameters
readerIDataReaderSource data reader.
Returns
- SqlAsyncMultiDataReader
New SqlAsyncMultiDataReader instance.
MultiQuery(IDbCommand)
Creates a new SqlMultiDataReader instance.
[Pure]
public static SqlMultiDataReader MultiQuery(this IDbCommand command)
Parameters
commandIDbCommandSource command.
Returns
- SqlMultiDataReader
New SqlMultiDataReader instance.
MultiQueryAsync(IDbCommand, CancellationToken)
Creates a new SqlAsyncMultiDataReader instance.
[Pure]
public static ValueTask<SqlAsyncMultiDataReader> MultiQueryAsync(this IDbCommand command, CancellationToken cancellationToken = default)
Parameters
commandIDbCommandSource command.
cancellationTokenCancellationTokenOptional CancellationToken.
Returns
- ValueTask<SqlAsyncMultiDataReader>
ValueTask<TResult> that returns a new SqlAsyncMultiDataReader instance.
Parameterize(SqlAsyncQueryReaderExecutor, SqlParameterBinder)
Binds the provided SqlAsyncQueryReaderExecutor to the given parameterBinder.
[Pure]
public static SqlAsyncParameterizedQueryReaderExecutor Parameterize(this SqlAsyncQueryReaderExecutor executor, SqlParameterBinder parameterBinder)
Parameters
executorSqlAsyncQueryReaderExecutorQuery reader executor.
parameterBinderSqlParameterBinderParameter binder to bind to the executor.
Returns
Parameterize(SqlAsyncScalarQueryReaderExecutor, SqlParameterBinder)
Binds the provided SqlAsyncScalarQueryReaderExecutor to the given parameterBinder.
[Pure]
public static SqlAsyncParameterizedScalarQueryReaderExecutor Parameterize(this SqlAsyncScalarQueryReaderExecutor executor, SqlParameterBinder parameterBinder)
Parameters
executorSqlAsyncScalarQueryReaderExecutorQuery reader executor.
parameterBinderSqlParameterBinderParameter binder to bind to the executor.
Returns
- SqlAsyncParameterizedScalarQueryReaderExecutor
New SqlAsyncParameterizedScalarQueryReaderExecutor instance.
Parameterize(SqlQueryReaderExecutor, SqlParameterBinder)
Binds the provided SqlQueryReaderExecutor to the given parameterBinder.
[Pure]
public static SqlParameterizedQueryReaderExecutor Parameterize(this SqlQueryReaderExecutor executor, SqlParameterBinder parameterBinder)
Parameters
executorSqlQueryReaderExecutorQuery reader executor.
parameterBinderSqlParameterBinderParameter binder to bind to the executor.
Returns
Parameterize(SqlScalarQueryReaderExecutor, SqlParameterBinder)
Binds the provided SqlScalarQueryReaderExecutor to the given parameterBinder.
[Pure]
public static SqlParameterizedScalarQueryReaderExecutor Parameterize(this SqlScalarQueryReaderExecutor executor, SqlParameterBinder parameterBinder)
Parameters
executorSqlScalarQueryReaderExecutorQuery reader executor.
parameterBinderSqlParameterBinderParameter binder to bind to the executor.
Returns
Parameterize<TCommand>(TCommand, SqlParameterBinderExecutor)
Binds parameters to the provided command.
public static TCommand Parameterize<TCommand>(this TCommand command, SqlParameterBinderExecutor executor) where TCommand : IDbCommand
Parameters
commandTCommandSource command.
executorSqlParameterBinderExecutorSqlParameterBinderExecutor to use for binding.
Returns
- TCommand
command.
Type Parameters
TCommandDB command type.
Parameterize<TParameter, TRow>(SqlAsyncQueryReaderExecutor<TRow>, SqlParameterBinder<TParameter>)
Binds the provided SqlAsyncQueryReaderExecutor<TRow> to the given parameterBinder.
[Pure]
public static SqlAsyncParameterizedQueryReaderExecutor<TParameter, TRow> Parameterize<TParameter, TRow>(this SqlAsyncQueryReaderExecutor<TRow> executor, SqlParameterBinder<TParameter> parameterBinder) where TParameter : notnull where TRow : notnull
Parameters
executorSqlAsyncQueryReaderExecutor<TRow>Query reader executor.
parameterBinderSqlParameterBinder<TParameter>Parameter binder to bind to the executor.
Returns
- SqlAsyncParameterizedQueryReaderExecutor<TParameter, TRow>
New SqlAsyncParameterizedQueryReaderExecutor<TParameter, TRow> instance.
Type Parameters
TParameterParameter source type.
TRowRow type.
Parameterize<TParameter, T>(SqlAsyncScalarQueryReaderExecutor<T>, SqlParameterBinder<TParameter>)
Binds the provided SqlAsyncQueryReaderExecutor<TRow> to the given parameterBinder.
[Pure]
public static SqlAsyncParameterizedScalarQueryReaderExecutor<TParameter, T> Parameterize<TParameter, T>(this SqlAsyncScalarQueryReaderExecutor<T> executor, SqlParameterBinder<TParameter> parameterBinder) where TParameter : notnull
Parameters
executorSqlAsyncScalarQueryReaderExecutor<T>Query reader executor.
parameterBinderSqlParameterBinder<TParameter>Parameter binder to bind to the executor.
Returns
- SqlAsyncParameterizedScalarQueryReaderExecutor<TParameter, T>
New SqlAsyncParameterizedScalarQueryReaderExecutor<TParameter, T> instance.
Type Parameters
TParameterParameter source type.
TValue type.
Parameterize<TParameter, TRow>(SqlQueryReaderExecutor<TRow>, SqlParameterBinder<TParameter>)
Binds the provided SqlQueryReaderExecutor<TRow> to the given parameterBinder.
[Pure]
public static SqlParameterizedQueryReaderExecutor<TParameter, TRow> Parameterize<TParameter, TRow>(this SqlQueryReaderExecutor<TRow> executor, SqlParameterBinder<TParameter> parameterBinder) where TParameter : notnull where TRow : notnull
Parameters
executorSqlQueryReaderExecutor<TRow>Query reader executor.
parameterBinderSqlParameterBinder<TParameter>Parameter binder to bind to the executor.
Returns
- SqlParameterizedQueryReaderExecutor<TParameter, TRow>
New SqlParameterizedQueryReaderExecutor<TParameter, TRow> instance.
Type Parameters
TParameterParameter source type.
TRowRow type.
Parameterize<TParameter, T>(SqlScalarQueryReaderExecutor<T>, SqlParameterBinder<TParameter>)
Binds the provided SqlQueryReaderExecutor<TRow> to the given parameterBinder.
[Pure]
public static SqlParameterizedScalarQueryReaderExecutor<TParameter, T> Parameterize<TParameter, T>(this SqlScalarQueryReaderExecutor<T> executor, SqlParameterBinder<TParameter> parameterBinder) where TParameter : notnull
Parameters
executorSqlScalarQueryReaderExecutor<T>Query reader executor.
parameterBinderSqlParameterBinder<TParameter>Parameter binder to bind to the executor.
Returns
- SqlParameterizedScalarQueryReaderExecutor<TParameter, T>
New SqlParameterizedScalarQueryReaderExecutor<TParameter, T> instance.
Type Parameters
TParameterParameter source type.
TValue type.
Parameterize<TCommand, TSource>(TCommand, SqlParameterBinderExecutor<TSource>)
Binds parameters to the provided command.
public static TCommand Parameterize<TCommand, TSource>(this TCommand command, SqlParameterBinderExecutor<TSource> executor) where TCommand : IDbCommand where TSource : notnull
Parameters
commandTCommandSource command.
executorSqlParameterBinderExecutor<TSource>SqlParameterBinderExecutor<TSource> to use for binding.
Returns
- TCommand
command.
Type Parameters
TCommandDB command type.
TSourceParameter source type.
Query(IDbCommand, SqlQueryReader, SqlQueryReaderOptions?)
Reads a collection of rows.
[Pure]
public static SqlQueryResult Query(this IDbCommand command, SqlQueryReader reader, SqlQueryReaderOptions? options = null)
Parameters
commandIDbCommandSource command.
readerSqlQueryReaderSqlQueryReader to use for reading.
optionsSqlQueryReaderOptions?Query reader options.
Returns
- SqlQueryResult
Returns a collection of read rows.
Query(IDbCommand, SqlQueryReaderExecutor, SqlQueryReaderOptions?)
Reads a collection of rows.
[Pure]
public static SqlQueryResult Query(this IDbCommand command, SqlQueryReaderExecutor executor, SqlQueryReaderOptions? options = null)
Parameters
commandIDbCommandSource command.
executorSqlQueryReaderExecutorSqlQueryReaderExecutor to use for reading.
optionsSqlQueryReaderOptions?Query reader options.
Returns
- SqlQueryResult
Returns a collection of read rows.
Query(IDbCommand, SqlScalarQueryReader)
Reads a scalar value.
[Pure]
public static SqlScalarQueryResult Query(this IDbCommand command, SqlScalarQueryReader reader)
Parameters
commandIDbCommandSource command.
readerSqlScalarQueryReaderSqlScalarQueryReader to use for reading.
Returns
- SqlScalarQueryResult
Returns a read scalar value.
Query(IDbCommand, SqlScalarQueryReaderExecutor)
Reads a scalar value.
[Pure]
public static SqlScalarQueryResult Query(this IDbCommand command, SqlScalarQueryReaderExecutor executor)
Parameters
commandIDbCommandSource command.
executorSqlScalarQueryReaderExecutorSqlScalarQueryReaderExecutor to use for reading.
Returns
- SqlScalarQueryResult
Returns a read scalar value.
QueryAsync(IDbCommand, SqlAsyncQueryReader, SqlQueryReaderOptions?, CancellationToken)
Asynchronously reads a collection of rows.
[Pure]
public static ValueTask<SqlQueryResult> QueryAsync(this IDbCommand command, SqlAsyncQueryReader reader, SqlQueryReaderOptions? options = null, CancellationToken cancellationToken = default)
Parameters
commandIDbCommandSource command.
readerSqlAsyncQueryReaderSqlAsyncQueryReader to use for reading.
optionsSqlQueryReaderOptions?Query reader options.
cancellationTokenCancellationTokenOptional CancellationToken.
Returns
- ValueTask<SqlQueryResult>
ValueTask<TResult> that returns a collection of read rows.
QueryAsync(IDbCommand, SqlAsyncQueryReaderExecutor, SqlQueryReaderOptions?, CancellationToken)
Asynchronously reads a collection of rows.
[Pure]
public static ValueTask<SqlQueryResult> QueryAsync(this IDbCommand command, SqlAsyncQueryReaderExecutor executor, SqlQueryReaderOptions? options = null, CancellationToken cancellationToken = default)
Parameters
commandIDbCommandSource command.
executorSqlAsyncQueryReaderExecutorSqlAsyncQueryReaderExecutor to use for reading.
optionsSqlQueryReaderOptions?Query reader options.
cancellationTokenCancellationTokenOptional CancellationToken.
Returns
- ValueTask<SqlQueryResult>
ValueTask<TResult> that returns a collection of read rows.
QueryAsync(IDbCommand, SqlAsyncScalarQueryReader, CancellationToken)
Asynchronously reads a scalar value.
[Pure]
public static ValueTask<SqlScalarQueryResult> QueryAsync(this IDbCommand command, SqlAsyncScalarQueryReader reader, CancellationToken cancellationToken = default)
Parameters
commandIDbCommandSource command.
readerSqlAsyncScalarQueryReaderSqlAsyncScalarQueryReader to use for reading.
cancellationTokenCancellationTokenOptional CancellationToken.
Returns
- ValueTask<SqlScalarQueryResult>
ValueTask<TResult> that returns a read scalar value.
QueryAsync(IDbCommand, SqlAsyncScalarQueryReaderExecutor, CancellationToken)
Asynchronously reads a scalar value.
[Pure]
public static ValueTask<SqlScalarQueryResult> QueryAsync(this IDbCommand command, SqlAsyncScalarQueryReaderExecutor executor, CancellationToken cancellationToken = default)
Parameters
commandIDbCommandSource command.
executorSqlAsyncScalarQueryReaderExecutorSqlAsyncScalarQueryReaderExecutor to use for reading.
cancellationTokenCancellationTokenOptional CancellationToken.
Returns
- ValueTask<SqlScalarQueryResult>
ValueTask<TResult> that returns a read scalar value.
QueryAsync<TRow>(IDbCommand, SqlAsyncQueryReaderExecutor<TRow>, SqlQueryReaderOptions?, CancellationToken)
Asynchronously reads a collection of rows.
[Pure]
public static ValueTask<SqlQueryResult<TRow>> QueryAsync<TRow>(this IDbCommand command, SqlAsyncQueryReaderExecutor<TRow> executor, SqlQueryReaderOptions? options = null, CancellationToken cancellationToken = default) where TRow : notnull
Parameters
commandIDbCommandSource command.
executorSqlAsyncQueryReaderExecutor<TRow>SqlAsyncQueryReaderExecutor<TRow> to use for reading.
optionsSqlQueryReaderOptions?Query reader options.
cancellationTokenCancellationTokenOptional CancellationToken.
Returns
- ValueTask<SqlQueryResult<TRow>>
ValueTask<TResult> that returns a collection of read rows.
Type Parameters
TRowRow type.
QueryAsync<TRow>(IDbCommand, SqlAsyncQueryReader<TRow>, SqlQueryReaderOptions?, CancellationToken)
Asynchronously reads a collection of rows.
[Pure]
public static ValueTask<SqlQueryResult<TRow>> QueryAsync<TRow>(this IDbCommand command, SqlAsyncQueryReader<TRow> reader, SqlQueryReaderOptions? options = null, CancellationToken cancellationToken = default) where TRow : notnull
Parameters
commandIDbCommandSource command.
readerSqlAsyncQueryReader<TRow>SqlAsyncQueryReader<TRow> to use for reading.
optionsSqlQueryReaderOptions?Query reader options.
cancellationTokenCancellationTokenOptional CancellationToken.
Returns
- ValueTask<SqlQueryResult<TRow>>
ValueTask<TResult> that returns a collection of read rows.
Type Parameters
TRowRow type.
QueryAsync<T>(IDbCommand, SqlAsyncScalarQueryReaderExecutor<T>, CancellationToken)
Asynchronously reads a scalar value.
[Pure]
public static ValueTask<SqlScalarQueryResult<T>> QueryAsync<T>(this IDbCommand command, SqlAsyncScalarQueryReaderExecutor<T> executor, CancellationToken cancellationToken = default)
Parameters
commandIDbCommandSource command.
executorSqlAsyncScalarQueryReaderExecutor<T>SqlAsyncScalarQueryReaderExecutor<T> to use for reading.
cancellationTokenCancellationTokenOptional CancellationToken.
Returns
- ValueTask<SqlScalarQueryResult<T>>
ValueTask<TResult> that returns a read scalar value.
Type Parameters
TValue type.
QueryAsync<T>(IDbCommand, SqlAsyncScalarQueryReader<T>, CancellationToken)
Asynchronously reads a scalar value.
[Pure]
public static ValueTask<SqlScalarQueryResult<T>> QueryAsync<T>(this IDbCommand command, SqlAsyncScalarQueryReader<T> reader, CancellationToken cancellationToken = default)
Parameters
commandIDbCommandSource command.
readerSqlAsyncScalarQueryReader<T>SqlAsyncScalarQueryReader<T> to use for reading.
cancellationTokenCancellationTokenOptional CancellationToken.
Returns
- ValueTask<SqlScalarQueryResult<T>>
ValueTask<TResult> that returns a read scalar value.
Type Parameters
TValue type.
Query<TRow>(IDbCommand, SqlQueryReaderExecutor<TRow>, SqlQueryReaderOptions?)
Reads a collection of rows.
[Pure]
public static SqlQueryResult<TRow> Query<TRow>(this IDbCommand command, SqlQueryReaderExecutor<TRow> executor, SqlQueryReaderOptions? options = null) where TRow : notnull
Parameters
commandIDbCommandSource command.
executorSqlQueryReaderExecutor<TRow>SqlQueryReaderExecutor<TRow> to use for reading.
optionsSqlQueryReaderOptions?Query reader options.
Returns
- SqlQueryResult<TRow>
Returns a collection of read rows.
Type Parameters
TRowRow type.
Query<TRow>(IDbCommand, SqlQueryReader<TRow>, SqlQueryReaderOptions?)
Reads a collection of rows.
[Pure]
public static SqlQueryResult<TRow> Query<TRow>(this IDbCommand command, SqlQueryReader<TRow> reader, SqlQueryReaderOptions? options = null) where TRow : notnull
Parameters
commandIDbCommandSource command.
readerSqlQueryReader<TRow>SqlQueryReader<TRow> to use for reading.
optionsSqlQueryReaderOptions?Query reader options.
Returns
- SqlQueryResult<TRow>
Returns a collection of read rows.
Type Parameters
TRowRow type.
Query<T>(IDbCommand, SqlScalarQueryReaderExecutor<T>)
Reads a scalar value.
[Pure]
public static SqlScalarQueryResult<T> Query<T>(this IDbCommand command, SqlScalarQueryReaderExecutor<T> executor)
Parameters
commandIDbCommandSource command.
executorSqlScalarQueryReaderExecutor<T>SqlScalarQueryReaderExecutor<T> to use for reading.
Returns
- SqlScalarQueryResult<T>
Returns a read scalar value.
Type Parameters
TValue type.
Query<T>(IDbCommand, SqlScalarQueryReader<T>)
Reads a scalar value.
[Pure]
public static SqlScalarQueryResult<T> Query<T>(this IDbCommand command, SqlScalarQueryReader<T> reader)
Parameters
commandIDbCommandSource command.
readerSqlScalarQueryReader<T>SqlScalarQueryReader<T> to use for reading.
Returns
- SqlScalarQueryResult<T>
Returns a read scalar value.
Type Parameters
TValue type.
SetText<TCommand>(TCommand, string)
Updates the CommandText of the provided command.
public static TCommand SetText<TCommand>(this TCommand command, string sql) where TCommand : IDbCommand
Parameters
commandTCommandSource command.
sqlstringValue to set.
Returns
- TCommand
command.
Type Parameters
TCommandDB command type.
SetTimeout<TCommand>(TCommand, TimeSpan)
Updates the CommandTimeout of the provided command.
public static TCommand SetTimeout<TCommand>(this TCommand command, TimeSpan timeout) where TCommand : IDbCommand
Parameters
commandTCommandSource command.
timeoutTimeSpanValue to set.
Returns
- TCommand
command.
Type Parameters
TCommandDB command type.
Exceptions
- ArgumentException
When
timeoutis less 0.