Struct ResultSet
A single column-bearing result set of a multi-result command, produced by enumerating ProcedureResult or BatchResult. The cursor is valid only while its set is the current one: reading after the outer traversal has advanced or ended, after a previous read of the same set, or through an uninitialized default value throws InvalidOperationException; reading after the owning result was disposed throws ObjectDisposedException.
public readonly struct ResultSet
- Inherited Members
- Extension Methods
Remarks
ColumnNames is snapshotted when the cursor is produced and stays readable after the outer cursor advances. Each set can be consumed once, either with Read<T>() (eager) or with ReadAsync<T>(CancellationToken) (lazy); mixing the two on one set is rejected.
Properties
ColumnNames
The column names of this result set, snapshotted when the cursor was produced.
public IReadOnlyList<string> ColumnNames { get; }
Property Value
FieldCount
The number of columns in this result set.
public int FieldCount { get; }
Property Value
Index
The 0-based position of this set among the column-bearing result sets of the command.
public int Index { get; }
Property Value
Methods
ReadAsync<T>(CancellationToken)
Lazily reads the rows of this result set into T.
public IAsyncEnumerable<T> ReadAsync<T>(CancellationToken ct = default)
Parameters
ctCancellationTokenCancels reading of this set.
Returns
- IAsyncEnumerable<T>
An async sequence over the rows of this set.
Type Parameters
TA mapped entity type or a scalar type (see IRawCommandExecutor).
Exceptions
- InvalidOperationException
The cursor is uninitialized, stale, already read, or the traversal has ended.
- ObjectDisposedException
The owning result has been disposed.
Read<T>()
Materializes all rows of this result set into T (eager).
public IReadOnlyList<T> Read<T>()
Returns
- IReadOnlyList<T>
The rows of this set; empty when the set has no rows.
Type Parameters
TA mapped entity type or a scalar type (see IRawCommandExecutor).
Exceptions
- InvalidOperationException
The cursor is uninitialized, stale, already read, or the traversal has ended.
- ObjectDisposedException
The owning result has been disposed.