Table of Contents

Method ToImmutableArrayAsync

Namespace
Open.Database.Extensions
Assembly
Open.Database.Extensions.Core.dll

ToImmutableArrayAsync<T>(IMappedQuery<T>, CancellationToken)

Asynchronously reads every mapped row into a new ImmutableArray<T>.

public static ValueTask<ImmutableArray<T>> ToImmutableArrayAsync<T>(this IMappedQuery<T> query, CancellationToken cancellationToken = default)

Parameters

query IMappedQuery<T>

The query to execute.

cancellationToken CancellationToken

Cancels the operation. When it cannot be canceled, the cancellation token set on the underlying command applies.

Returns

ValueTask<ImmutableArray<T>>

A task that produces an immutable array of all the rows, in the order the database returned them.

Type Parameters

T

The type each row is mapped to.

Remarks

All rows are buffered in memory before the call returns. Use Read(Action<IEnumerable<T>>) to process very large results as a stream.

Exceptions

OperationCanceledException

The operation was canceled.

See Also