DbRawSqlQuery<TElement>::CountAsync Method
Asynchronously returns the number of elements in the query.
Assembly: EntityFramework (in EntityFramework.dll)
| Name | Description | |
|---|---|---|
![]() | CountAsync() | Asynchronously returns the number of elements in the query. |
![]() | CountAsync(CancellationToken) | Asynchronously returns the number of elements in the query. |
![]() | CountAsync(Func<TElement, Boolean>^) | Asynchronously returns the number of elements in the query that satisfy a condition. |
![]() | CountAsync(Func<TElement, Boolean>^, CancellationToken) | Asynchronously returns the number of elements in the query that satisfy a condition. |
DbRawSqlQuery<TElement>::CountAsync Method ()
Asynchronously returns the number of elements in the query.
| Exception | Condition |
|---|---|
| OverflowException | The number of elements in the query result is larger than MaxValue . |
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.
DbRawSqlQuery<TElement>::CountAsync Method (CancellationToken)
Asynchronously returns the number of elements in the query.
Parameters
- cancellationToken
-
Type:
System.Threading::CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks::Task<Int32>^A task that represents the asynchronous operation. The task result contains the number of elements in the query result.
| Exception | Condition |
|---|---|
| OverflowException | The number of elements in the query result is larger than MaxValue . |
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.
DbRawSqlQuery<TElement>::CountAsync Method (Func<TElement, Boolean>^)
Asynchronously returns the number of elements in the query that satisfy a condition.
Parameters
- predicate
-
Type:
System::Func<TElement, Boolean>^
A function to test each element for a condition.
Return Value
Type: System.Threading.Tasks::Task<Int32>^A task that represents the asynchronous operation. The task result contains the number of elements in the query result that satisfy the condition in the predicate function.
| Exception | Condition |
|---|---|
| OverflowException | The number of elements in the query result that satisfy the condition in the predicate function is larger than MaxValue . |
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.
DbRawSqlQuery<TElement>::CountAsync Method (Func<TElement, Boolean>^, CancellationToken)
Asynchronously returns the number of elements in the query that satisfy a condition.
public: Task<int>^ CountAsync( Func<TElement, bool>^ predicate, CancellationToken cancellationToken )
Parameters
- predicate
-
Type:
System::Func<TElement, 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<Int32>^A task that represents the asynchronous operation. The task result contains the number of elements in the query result that satisfy the condition in the predicate function.
| Exception | Condition |
|---|---|
| OverflowException | The number of elements in the query result that satisfy the condition in the predicate function is larger than MaxValue . |
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.
