Struct SqlParameterizedStatementExecutor<T>
- Namespace
- LfrlAnvil.Sql.Statements
- Assembly
- LfrlAnvil.Sql.Core.dll
Represents an SqlParameterBinder<TSource> bound to a specific SQL statement.
public readonly record struct SqlParameterizedStatementExecutor<T> : IEquatable<SqlParameterizedStatementExecutor<T>> where T : notnull
Type Parameters
TParameter source type.
- Implements
- Inherited Members
Constructors
SqlParameterizedStatementExecutor(SqlParameterBinder<T>, string)
Represents an SqlParameterBinder<TSource> bound to a specific SQL statement.
public SqlParameterizedStatementExecutor(SqlParameterBinder<T> ParameterBinder, string Sql)
Parameters
ParameterBinderSqlParameterBinder<T>Underlying parameter binder.
SqlstringBound SQL statement.
Properties
ParameterBinder
Underlying parameter binder.
public SqlParameterBinder<T> ParameterBinder { get; init; }
Property Value
Sql
Bound SQL statement.
public string Sql { get; init; }
Property Value
Methods
Execute(IDbCommand, IEnumerable<T?>)
Executes the Sql statement for each parameter source in the parameters collection.
public long Execute(IDbCommand command, IEnumerable<T?> parameters)
Parameters
commandIDbCommandCommand to execute the statement with.
parametersIEnumerable<T>Collection of sources of parameters to bind.
Returns
- long
The number of rows affected.
Execute(IDbCommand, T?)
Executes the Sql statement with the given parameters.
public int Execute(IDbCommand command, T? parameters)
Parameters
commandIDbCommandCommand to execute the statement with.
parametersTSource of parameters to bind.
Returns
- int
The number of rows affected.
ExecuteAsync(IDbCommand, IEnumerable<T?>, CancellationToken)
Asynchronously executes the Sql statement for each parameter source in the parameters collection.
public ValueTask<long> ExecuteAsync(IDbCommand command, IEnumerable<T?> parameters, CancellationToken cancellationToken = default)
Parameters
commandIDbCommandCommand to execute the statement with.
parametersIEnumerable<T>Collection of sources of parameters to bind.
cancellationTokenCancellationTokenOptional CancellationToken.
Returns
- ValueTask<long>
ValueTask<TResult> that returns the number of rows affected.
ExecuteAsync(IDbCommand, T?, CancellationToken)
Asynchronously executes the Sql statement with the given parameters.
public ValueTask<int> ExecuteAsync(IDbCommand command, T? parameters, CancellationToken cancellationToken = default)
Parameters
commandIDbCommandCommand to execute the statement with.
parametersTSource of parameters to bind.
cancellationTokenCancellationTokenOptional CancellationToken.
Returns
- ValueTask<int>
ValueTask<TResult> that returns the number of rows affected.
MultiQuery(IDbCommand, T?)
Creates a new parameterized SqlMultiDataReader instance.
public SqlMultiDataReader MultiQuery(IDbCommand command, T? parameters)
Parameters
commandIDbCommandSource command.
parametersTSource of parameters to bind.
Returns
- SqlMultiDataReader
New SqlMultiDataReader instance.
MultiQueryAsync(IDbCommand, T?, CancellationToken)
Asynchronously creates a new parameterized SqlAsyncMultiDataReader instance.
public ValueTask<SqlAsyncMultiDataReader> MultiQueryAsync(IDbCommand command, T? parameters, CancellationToken cancellationToken = default)
Parameters
commandIDbCommandSource command.
parametersTSource of parameters to bind.
cancellationTokenCancellationTokenOptional CancellationToken.
Returns
- ValueTask<SqlAsyncMultiDataReader>
ValueTask<TResult> that returns a new SqlAsyncMultiDataReader instance.