DbRawSqlQuery<TElement>.CountAsync Method

Definition

Overloads

CountAsync()

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

Asynchronously returns the number of elements in the query.

CountAsync(Func<TElement,Boolean>, CancellationToken)

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

CountAsync()

Asynchronously returns the number of elements in the query.

public System.Threading.Tasks.Task<int> CountAsync ();
member this.CountAsync : unit -> System.Threading.Tasks.Task<int>
Public Function CountAsync () As Task(Of Integer)

Returns

A task that represents the asynchronous operation. The task result contains the number of elements in the query result.

Exceptions

The number of elements in the query result is larger than MaxValue .

Remarks

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.

Applies to

CountAsync(Func<TElement,Boolean>)

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

public System.Threading.Tasks.Task<int> CountAsync (Func<TElement,bool> predicate);
member this.CountAsync : Func<'Element, bool> -> System.Threading.Tasks.Task<int>
Public Function CountAsync (predicate As Func(Of TElement, Boolean)) As Task(Of Integer)

Parameters

predicate
Func<TElement,Boolean>

A function to test each element for a condition.

Returns

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.

Exceptions

The number of elements in the query result that satisfy the condition in the predicate function is larger than MaxValue .

Remarks

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.

Applies to

CountAsync(CancellationToken)

Asynchronously returns the number of elements in the query.

public System.Threading.Tasks.Task<int> CountAsync (System.Threading.CancellationToken cancellationToken);
member this.CountAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<int>

Parameters

cancellationToken
CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

A task that represents the asynchronous operation. The task result contains the number of elements in the query result.

Exceptions

The number of elements in the query result is larger than MaxValue .

Remarks

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.

Applies to

CountAsync(Func<TElement,Boolean>, CancellationToken)

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

public System.Threading.Tasks.Task<int> CountAsync (Func<TElement,bool> predicate, System.Threading.CancellationToken cancellationToken);
member this.CountAsync : Func<'Element, bool> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<int>

Parameters

predicate
Func<TElement,Boolean>

A function to test each element for a condition.

cancellationToken
CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

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.

Exceptions

The number of elements in the query result that satisfy the condition in the predicate function is larger than MaxValue .

Remarks

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.

Applies to