Interface IPreparedQueryCommand<TResult>
A query that has been compiled once and can be executed repeatedly.
public interface IPreparedQueryCommand<TResult>
Type Parameters
TResult
- Extension Methods
Methods
CreateAsyncEnumerator(IDataContext, params object[]?)
Creates an asynchronous enumerator over the result rows using None.
IAsyncEnumerator<TResult> CreateAsyncEnumerator(IDataContext dataContext, params object[]? @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
paramsobject[]The positional parameter values bound to the query, or null for none.
Returns
- IAsyncEnumerator<TResult>
An asynchronous enumerator over the result rows.
CreateAsyncEnumerator(IDataContext, CancellationToken, params object[]?)
Creates an asynchronous enumerator over the result rows, honouring a cancellation token.
IAsyncEnumerator<TResult> CreateAsyncEnumerator(IDataContext dataContext, CancellationToken cancellationToken, params object[]? @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
cancellationTokenCancellationTokenCancels the opening and enumeration of the reader.
paramsobject[]The positional parameter values bound to the query, or null for none.
Returns
- IAsyncEnumerator<TResult>
An asynchronous enumerator over the result rows.
CreateEnumerator(IDataContext, params object[]?)
Creates a synchronous enumerator over the result rows.
IEnumerator<TResult> CreateEnumerator(IDataContext dataContext, params object[]? @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
paramsobject[]The positional parameter values bound to the query, or null for none.
Returns
- IEnumerator<TResult>
A synchronous enumerator over the result rows.
CreateEnumeratorAsync(IDataContext, params object[]?)
Creates a synchronous enumerator over the result rows using None to open the reader.
Task<IEnumerator<TResult>> CreateEnumeratorAsync(IDataContext dataContext, params object[]? @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
paramsobject[]The positional parameter values bound to the query, or null for none.
Returns
- Task<IEnumerator<TResult>>
A task producing a synchronous enumerator over the result rows.
CreateEnumeratorAsync(IDataContext, CancellationToken, params object[]?)
Creates a synchronous enumerator over the result rows, awaiting the reader open with a cancellation token.
Task<IEnumerator<TResult>> CreateEnumeratorAsync(IDataContext dataContext, CancellationToken cancellationToken, params object[]? @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
cancellationTokenCancellationTokenCancels the opening of the reader.
paramsobject[]The positional parameter values bound to the query, or null for none.
Returns
- Task<IEnumerator<TResult>>
A task producing a synchronous enumerator over the result rows.
ExecuteScalar(IDataContext, bool, params ReadOnlySpan<object?>)
Executes the query and returns its scalar value.
TResult? ExecuteScalar(IDataContext dataContext, bool throwIfNull, params ReadOnlySpan<object?> @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
throwIfNullboolWhether to throw when the scalar is null instead of returning it.
paramsReadOnlySpan<object>The positional parameter values bound to the query.
Returns
- TResult
The scalar value, or null when none was returned.
ExecuteScalarAsync(IDataContext, bool, params object[]?)
Executes the query and returns its scalar value using None.
Task<TResult?> ExecuteScalarAsync(IDataContext dataContext, bool throwIfNull, params object[]? @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
throwIfNullboolWhether to throw when the scalar is null instead of returning it.
paramsobject[]The positional parameter values bound to the query, or null for none.
Returns
ExecuteScalarAsync(IDataContext, bool, CancellationToken, params object[]?)
Executes the query and returns its scalar value, honouring a cancellation token.
Task<TResult?> ExecuteScalarAsync(IDataContext dataContext, bool throwIfNull, CancellationToken cancellationToken, params object[]? @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
throwIfNullboolWhether to throw when the scalar is null instead of returning it.
cancellationTokenCancellationTokenCancels execution of the query.
paramsobject[]The positional parameter values bound to the query, or null for none.
Returns
First(IDataContext, params ReadOnlySpan<object?>)
Returns the first result row, throwing when the query returns none.
TResult First(IDataContext dataContext, params ReadOnlySpan<object?> @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
paramsReadOnlySpan<object>The positional parameter values bound to the query.
Returns
- TResult
The first result row.
FirstAsync(IDataContext, params object[]?)
Returns the first result row asynchronously using None, throwing when the query returns none.
Task<TResult> FirstAsync(IDataContext dataContext, params object[]? @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
paramsobject[]The positional parameter values bound to the query, or null for none.
Returns
- Task<TResult>
A task producing the first result row.
FirstAsync(IDataContext, CancellationToken, params object[]?)
Returns the first result row asynchronously, honouring a cancellation token and throwing when the query returns none.
Task<TResult> FirstAsync(IDataContext dataContext, CancellationToken cancellationToken, params object[]? @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
cancellationTokenCancellationTokenCancels reading of the result row.
paramsobject[]The positional parameter values bound to the query, or null for none.
Returns
- Task<TResult>
A task producing the first result row.
FirstOrDefault(IDataContext, params ReadOnlySpan<object?>)
Returns the first result row, or the default value when the query returns none.
TResult? FirstOrDefault(IDataContext dataContext, params ReadOnlySpan<object?> @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
paramsReadOnlySpan<object>The positional parameter values bound to the query.
Returns
- TResult
The first result row, or the default value of
TResult.
FirstOrDefaultAsync(IDataContext, params object[]?)
Returns the first result row asynchronously using None, or the default value when the query returns none.
Task<TResult?> FirstOrDefaultAsync(IDataContext dataContext, params object[]? @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
paramsobject[]The positional parameter values bound to the query, or null for none.
Returns
- Task<TResult>
A task producing the first result row, or the default value of
TResult.
FirstOrDefaultAsync(IDataContext, CancellationToken, params object[]?)
Returns the first result row asynchronously, or the default value when the query returns none.
Task<TResult?> FirstOrDefaultAsync(IDataContext dataContext, CancellationToken cancellationToken, params object[]? @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
cancellationTokenCancellationTokenCancels reading of the result row.
paramsobject[]The positional parameter values bound to the query, or null for none.
Returns
- Task<TResult>
A task producing the first result row, or the default value of
TResult.
Single(IDataContext, params ReadOnlySpan<object?>)
Returns the single result row, throwing when the query returns none or more than one.
TResult Single(IDataContext dataContext, params ReadOnlySpan<object?> @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
paramsReadOnlySpan<object>The positional parameter values bound to the query.
Returns
- TResult
The single result row.
SingleAsync(IDataContext, params object[]?)
Returns the single result row asynchronously using None, throwing when the query returns none or more than one.
Task<TResult> SingleAsync(IDataContext dataContext, params object[]? @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
paramsobject[]The positional parameter values bound to the query, or null for none.
Returns
- Task<TResult>
A task producing the single result row.
SingleAsync(IDataContext, CancellationToken, params object[]?)
Returns the single result row asynchronously, honouring a cancellation token and throwing when the query returns none or more than one.
Task<TResult> SingleAsync(IDataContext dataContext, CancellationToken cancellationToken, params object[]? @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
cancellationTokenCancellationTokenCancels reading of the result row.
paramsobject[]The positional parameter values bound to the query, or null for none.
Returns
- Task<TResult>
A task producing the single result row.
SingleOrDefault(IDataContext, params ReadOnlySpan<object?>)
Returns the single result row, or the default value when the query returns none, throwing when it returns more than one.
TResult? SingleOrDefault(IDataContext dataContext, params ReadOnlySpan<object?> @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
paramsReadOnlySpan<object>The positional parameter values bound to the query.
Returns
- TResult
The single result row, or the default value of
TResult.
SingleOrDefaultAsync(IDataContext, params object[]?)
Returns the single result row asynchronously using None, or the default value when the query returns none.
Task<TResult?> SingleOrDefaultAsync(IDataContext dataContext, params object[]? @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
paramsobject[]The positional parameter values bound to the query, or null for none.
Returns
- Task<TResult>
A task producing the single result row, or the default value of
TResult.
SingleOrDefaultAsync(IDataContext, CancellationToken, params object[]?)
Returns the single result row asynchronously, or the default value when the query returns none.
Task<TResult?> SingleOrDefaultAsync(IDataContext dataContext, CancellationToken cancellationToken, params object[]? @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
cancellationTokenCancellationTokenCancels reading of the result row.
paramsobject[]The positional parameter values bound to the query, or null for none.
Returns
- Task<TResult>
A task producing the single result row, or the default value of
TResult.
ToAsyncEnumerable(IDataContext, params object[])
Streams the result rows as an asynchronous sequence using None.
IAsyncEnumerable<TResult> ToAsyncEnumerable(IDataContext dataContext, params object[] @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
paramsobject[]The positional parameter values bound to the query.
Returns
- IAsyncEnumerable<TResult>
An asynchronous sequence over the result rows.
ToAsyncEnumerable(IDataContext, CancellationToken, params object[])
Streams the result rows as an asynchronous sequence, honouring a cancellation token.
IAsyncEnumerable<TResult> ToAsyncEnumerable(IDataContext dataContext, CancellationToken cancellationToken, params object[] @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
cancellationTokenCancellationTokenCancels the asynchronous enumeration.
paramsobject[]The positional parameter values bound to the query.
Returns
- IAsyncEnumerable<TResult>
An asynchronous sequence over the result rows.
ToEnumerable(IDataContext, params object[]?)
Streams the result rows as a synchronous sequence.
IEnumerable<TResult> ToEnumerable(IDataContext dataContext, params object[]? @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
paramsobject[]The positional parameter values bound to the query, or null for none.
Returns
- IEnumerable<TResult>
A synchronous sequence over the result rows.
ToList(IDataContext, params ReadOnlySpan<object?>)
Materializes the result rows into a list.
List<TResult> ToList(IDataContext dataContext, params ReadOnlySpan<object?> @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
paramsReadOnlySpan<object>The positional parameter values bound to the query.
Returns
- List<TResult>
The materialized result rows.
ToListAsync(IDataContext, params object[]?)
Materializes the result rows into a list using None.
Task<List<TResult>> ToListAsync(IDataContext dataContext, params object[]? @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
paramsobject[]The positional parameter values bound to the query, or null for none.
Returns
ToListAsync(IDataContext, CancellationToken, params object[]?)
Materializes the result rows into a list, honouring a cancellation token.
Task<List<TResult>> ToListAsync(IDataContext dataContext, CancellationToken cancellationToken, params object[]? @params)
Parameters
dataContextIDataContextThe context that supplies the underlying row reader.
cancellationTokenCancellationTokenCancels reading of the result rows.
paramsobject[]The positional parameter values bound to the query, or null for none.