Delen via


ExecutionStrategy.ExecuteInTransaction<TState,TResult> Method

Definition

Executes the specified operation in a transaction and returns the result after commiting it.

public virtual TResult ExecuteInTransaction<TState,TResult> (Func<TState,TResult> operation, Func<TState,bool> verifySucceeded, TState state);
abstract member ExecuteInTransaction : Func<'State, 'Result> * Func<'State, bool> * 'State -> 'Result
override this.ExecuteInTransaction : Func<'State, 'Result> * Func<'State, bool> * 'State -> 'Result
Public Overridable Function ExecuteInTransaction(Of TState, TResult) (operation As Func(Of TState, TResult), verifySucceeded As Func(Of TState, Boolean), state As TState) As TResult

Type Parameters

TState

The type of the state.

TResult

The return type of operation.

Parameters

operation
Func<TState,TResult>

A delegate representing an executable operation that returns the result of type TResult.

verifySucceeded
Func<TState,Boolean>

A delegate that tests whether the operation succeeded even though an exception was thrown when the transaction was being committed.

state
TState

The state that will be passed to the operation.

Returns

TResult

The result from the operation.

Exceptions

Thrown if the operation has not succeeded after the configured number of retries.

Applies to