DbRawSqlQuery<TElement>.CountAsync Method

 

Asynchronously returns the number of elements in the query.

Namespace:   System.Data.Entity.Infrastructure
Assembly:  EntityFramework (in EntityFramework.dll)

NameDescription
System_CAPS_pubmethodCountAsync()

Asynchronously returns the number of elements in the query.

System_CAPS_pubmethodCountAsync(CancellationToken)

Asynchronously returns the number of elements in the query.

System_CAPS_pubmethodCountAsync(Func<TElement, Boolean>)

Asynchronously returns the number of elements in the query that satisfy a condition.

System_CAPS_pubmethodCountAsync(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.

public Task<int> CountAsync()

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 (CancellationToken)

Asynchronously returns the number of elements in the query.

public Task<int> CountAsync(
	CancellationToken cancellationToken
)

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.

public Task<int> CountAsync(
	Func<TElement, bool> predicate
)

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.