QueryableExtensions.AllAsync Method
Asynchronously determines whether all the elements of a sequence satisfy a condition.
Assembly: EntityFramework (in EntityFramework.dll)
Name | Description | |
---|---|---|
![]() ![]() | AllAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Boolean>>) | Asynchronously determines whether all the elements of a sequence satisfy a condition. |
![]() ![]() | AllAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Boolean>>, CancellationToken) | Asynchronously determines whether all the elements of a sequence satisfy a condition. |
QueryableExtensions.AllAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Boolean>>)
Asynchronously determines whether all the elements of a sequence satisfy a condition.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<bool> AllAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
An IQueryable<T> whose elements to test for a condition.
- predicate
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Boolean>>
A function to test each element for a condition.
Return Value
Type: System.Threading.Tasks.Task<Boolean>A task that represents the asynchronous operation. The task result contains true if every element of the source sequence passes the test in the specified predicate; otherwise, false.
Type Parameters
- TSource
The type of the elements of source.
Exception | Condition |
---|---|
ArgumentNullException | source or predicate is null. |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.AllAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Boolean>>, CancellationToken)
Asynchronously determines whether all the elements of a sequence satisfy a condition.
[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] [SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<bool> AllAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
An IQueryable<T> whose elements to test for a condition.
- predicate
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Boolean>>
A function to test each element for a condition.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Boolean>A task that represents the asynchronous operation. The task result contains true if every element of the source sequence passes the test in the specified predicate; otherwise, false.
Type Parameters
- TSource
The type of the elements of source.
Exception | Condition |
---|---|
ArgumentNullException | source or predicate is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.