DbRawSqlQuery<TElement>::FirstAsync Method

Entity Framework 6.0
 

Asynchronously returns the first element of the query.

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

NameDescription
System_CAPS_pubmethodFirstAsync()

Asynchronously returns the first element of the query.

System_CAPS_pubmethodFirstAsync(CancellationToken)

Asynchronously returns the first element of the query.

System_CAPS_pubmethodFirstAsync(Func<TElement, Boolean>^)

Asynchronously returns the first element of the query that satisfies a specified condition.

System_CAPS_pubmethodFirstAsync(Func<TElement, Boolean>^, CancellationToken)

Asynchronously returns the first element of the query that satisfies a specified condition.

Return to top

DbRawSqlQuery<TElement>::FirstAsync Method ()

Asynchronously returns the first element of the query.

public:
Task<TElement>^ FirstAsync()

Return Value

Type: System.Threading.Tasks::Task<TElement>^

A task that represents the asynchronous operation. The task result contains the first element in the query result.

Exception Condition
InvalidOperationException

The query result is empty.

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.

Return to top

DbRawSqlQuery<TElement>::FirstAsync Method (CancellationToken)

Asynchronously returns the first element of the query.

public:
Task<TElement>^ FirstAsync(
	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<TElement>^

A task that represents the asynchronous operation. The task result contains the first element in the query result.

Exception Condition
InvalidOperationException

The query result is empty.

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.

Return to top

DbRawSqlQuery<TElement>::FirstAsync Method (Func<TElement, Boolean>^)

Asynchronously returns the first element of the query that satisfies a specified condition.

public:
Task<TElement>^ FirstAsync(
	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<TElement>^

A task that represents the asynchronous operation. The task result contains the first element in the query result that satisfies a specified condition.

Exception Condition
ArgumentNullException

predicate is null .

InvalidOperationException

The query result is empty.

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.

Return to top

DbRawSqlQuery<TElement>::FirstAsync Method (Func<TElement, Boolean>^, CancellationToken)

Asynchronously returns the first element of the query that satisfies a specified condition.

public:
Task<TElement>^ FirstAsync(
	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<TElement>^

A task that represents the asynchronous operation. The task result contains the first element in the query result that satisfies a specified condition.

Exception Condition
ArgumentNullException

predicate is null .

InvalidOperationException

The query result is empty.

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.

Return to top
Show: