DbRawSqlQuery<TElement>.LongCountAsync Method (CancellationToken)

[This page is specific to the Entity Framework version 6. The latest version is available as the 'Entity Framework' NuGet package. For more information about Entity Framework, see msdn.com/data/ef.]

Asynchronously returns an Int64 that represents the total number of elements in the query.

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

Syntax

'Declaration
Public Function LongCountAsync ( _
    cancellationToken As CancellationToken _
) As Task(Of Long)
'Usage
Dim instance As DbRawSqlQuery 
Dim cancellationToken As CancellationToken 
Dim returnValue As Task(Of Long)

returnValue = instance.LongCountAsync(cancellationToken)
public Task<long> LongCountAsync(
    CancellationToken cancellationToken
)
public:
Task<long long>^ LongCountAsync(
    CancellationToken cancellationToken
)
member LongCountAsync : 
        cancellationToken:CancellationToken -> Task<int64> 
public function LongCountAsync(
    cancellationToken : CancellationToken
) : Task<long>

Parameters

Return Value

Type: System.Threading.Tasks.Task<Int64>
A task that represents the asynchronous operation. The task result contains the number of elements in the query result.

Exceptions

Exception Condition
OverflowException

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.

See Also

Reference

DbRawSqlQuery<TElement> Class

LongCountAsync Overload

System.Data.Entity.Infrastructure Namespace