IClientSessionWithTransactionAsyncTResult Method |
Executes a callback within a transaction, with retries if needed.
Namespace:
MongoDB.Driver
Assembly:
MongoDB.Driver (in MongoDB.Driver.dll) Version: 2.11.0+cb27a82ea70620ad1acad8058809be8302ae4f2a
Syntax Task<TResult> WithTransactionAsync<TResult>(
Func<IClientSessionHandle, CancellationToken, Task<TResult>> callbackAsync,
TransactionOptions transactionOptions = null,
CancellationToken cancellationToken = null
)
Function WithTransactionAsync(Of TResult) (
callbackAsync As Func(Of IClientSessionHandle, CancellationToken, Task(Of TResult)),
Optional transactionOptions As TransactionOptions = Nothing,
Optional cancellationToken As CancellationToken = Nothing
) As Task(Of TResult)
abstract WithTransactionAsync :
callbackAsync : Func<IClientSessionHandle, CancellationToken, Task<'TResult>> *
?transactionOptions : TransactionOptions *
?cancellationToken : CancellationToken
(* Defaults:
let _transactionOptions = defaultArg transactionOptions null
let _cancellationToken = defaultArg cancellationToken null
*)
-> Task<'TResult>
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:
TaskTResultThe callback result.
See Also