Click or drag to resize

IClientSessionWithTransactionAsyncTResult Method

Executes a callback within a transaction, with retries if needed.

Namespace:  MongoDB.Driver
Assembly:  MongoDB.Driver (in MongoDB.Driver.dll) Version: 2.9.0+32b058abcdf2c7e8d9dd3a676d207b31897eee2e
Syntax
Task<TResult> WithTransactionAsync<TResult>(
	Func<IClientSessionHandle, CancellationToken, Task<TResult>> callbackAsync,
	TransactionOptions transactionOptions = null,
	CancellationToken cancellationToken = null
)

Parameters

callbackAsync
Type: SystemFuncIClientSessionHandle, CancellationToken, TaskTResult
The user defined callback.
transactionOptions (Optional)
Type: MongoDB.DriverTransactionOptions
The transaction options.
cancellationToken (Optional)
Type: System.ThreadingCancellationToken
The cancellation token.

Type Parameters

TResult
The type of callback result.

Return Value

Type: TaskTResult
The callback result.
See Also