Share via


DbRawSqlQuery<TElement>.ForEachAsync Method

Definition

Overloads

ForEachAsync(Action<TElement>)

Asynchronously enumerates the query results and performs the specified action on each element.

ForEachAsync(Action<TElement>, CancellationToken)

Asynchronously enumerates the query results and performs the specified action on each element.

ForEachAsync(Action<TElement>)

Asynchronously enumerates the query results and performs the specified action on each element.

public System.Threading.Tasks.Task ForEachAsync (Action<TElement> action);
member this.ForEachAsync : Action<'Element> -> System.Threading.Tasks.Task
Public Function ForEachAsync (action As Action(Of TElement)) As Task

Parameters

action
Action<TElement>

The action to be executed.

Returns

A task that represents the asynchronous operation.

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

ForEachAsync(Action<TElement>, CancellationToken)

Asynchronously enumerates the query results and performs the specified action on each element.

public System.Threading.Tasks.Task ForEachAsync (Action<TElement> action, System.Threading.CancellationToken cancellationToken);
member this.ForEachAsync : Action<'Element> * System.Threading.CancellationToken -> System.Threading.Tasks.Task

Parameters

action
Action<TElement>

The action to be executed.

cancellationToken
CancellationToken

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

Returns

A task that represents the asynchronous operation.

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