QueryableAsyncExtensions

Ecng.Serialization

Extension methods for asynchronous queryable operations with bulk-load support.

Методы

AnyAsyncEx``1
public static ValueTask<bool> AnyAsyncEx<T>(IQueryable<T> source, CancellationToken cancellationToken)
result = QueryableAsyncExtensions.AnyAsyncEx(source, cancellationToken)

Asynchronously determines whether a queryable sequence contains any elements.

source
The queryable source.
cancellationToken
Cancellation token.

Возвращает: if the sequence contains any elements; otherwise, .

CountAsyncEx``1
public static ValueTask<long> CountAsyncEx<T>(IQueryable<T> source, CancellationToken cancellationToken)
result = QueryableAsyncExtensions.CountAsyncEx(source, cancellationToken)

Asynchronously counts the elements in a queryable sequence, using bulk-load when available.

source
The queryable source.
cancellationToken
Cancellation token.

Возвращает: The number of elements.

FirstOrDefaultAsyncEx``1
public static ValueTask<T> FirstOrDefaultAsyncEx<T>(IQueryable<T> source, CancellationToken cancellationToken)
result = QueryableAsyncExtensions.FirstOrDefaultAsyncEx(source, cancellationToken)

Asynchronously returns the first element of a sequence, or a default value, using bulk-load when available.

source
The queryable source.
cancellationToken
Cancellation token.

Возвращает: The first element, or the default value if the sequence is empty.

ToArrayAsyncEx``1
public static ValueTask<T[]> ToArrayAsyncEx<T>(IQueryable<T> source, CancellationToken cancellationToken)
result = QueryableAsyncExtensions.ToArrayAsyncEx(source, cancellationToken)

Asynchronously converts a queryable sequence to an array.

source
The queryable source.
cancellationToken
Cancellation token.

Возвращает: An array containing the elements.

ToAsync``1
public static IAsyncEnumerable<T> ToAsync<T>(IQueryable<T> q)
result = QueryableAsyncExtensions.ToAsync(q)

Converts a queryable to an async enumerable, returning the existing one if already async.

q
The queryable source.

Возвращает: An async enumerable over the elements.