Method QueryAsync
QueryAsync<T>(SqliteConnection, string, Func<SqliteDataReader, T>, IEnumerable<SqliteParameter>?, CancellationToken)
Runs sql and projects every row through map.
public static Task<IReadOnlyList<T>> QueryAsync<T>(this SqliteConnection connection, string sql, Func<SqliteDataReader, T> map, IEnumerable<SqliteParameter>? parameters = null, CancellationToken cancellationToken = default)
Parameters
connectionSqliteConnectionThe open connection to run the command on.
sqlstringThe SQL text to execute.
mapFunc<SqliteDataReader, T>Projects each read row to a
T.parametersIEnumerable<SqliteParameter>Parameters to bind, or null for none.
cancellationTokenCancellationTokenCancels the command.
Returns
- Task<IReadOnlyList<T>>
Every row, in cursor order.
Type Parameters
T
Exceptions
- ArgumentNullException
connectionormapis null.- ArgumentException
sqlis null, empty, or whitespace.