Table of Contents

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

T

Parameter 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

ParameterBinder SqlParameterBinder<T>

Underlying parameter binder.

Sql string

Bound SQL statement.

Properties

ParameterBinder

Underlying parameter binder.

public SqlParameterBinder<T> ParameterBinder { get; init; }

Property Value

SqlParameterBinder<T>

Sql

Bound SQL statement.

public string Sql { get; init; }

Property Value

string

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

command IDbCommand

Command to execute the statement with.

parameters IEnumerable<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

command IDbCommand

Command to execute the statement with.

parameters T

Source 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

command IDbCommand

Command to execute the statement with.

parameters IEnumerable<T>

Collection of sources of parameters to bind.

cancellationToken CancellationToken

Optional 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

command IDbCommand

Command to execute the statement with.

parameters T

Source of parameters to bind.

cancellationToken CancellationToken

Optional 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

command IDbCommand

Source command.

parameters T

Source 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

command IDbCommand

Source command.

parameters T

Source of parameters to bind.

cancellationToken CancellationToken

Optional CancellationToken.

Returns

ValueTask<SqlAsyncMultiDataReader>

ValueTask<TResult> that returns a new SqlAsyncMultiDataReader instance.