IClientSessionWithTransactionTResult Method |
Executes a callback within a transaction, with retries if needed.
Namespace:
MongoDB.Driver
Assembly:
MongoDB.Driver (in MongoDB.Driver.dll) Version: 2.22.0+75246110ed1247226fcc7f8eb2c54ffab745693e
Syntax TResult WithTransaction<TResult>(
Func<IClientSessionHandle, CancellationToken, TResult> callback,
TransactionOptions transactionOptions = null,
CancellationToken cancellationToken = default
)
Function WithTransaction(Of TResult) (
callback As Func(Of IClientSessionHandle, CancellationToken, TResult),
Optional transactionOptions As TransactionOptions = Nothing,
Optional cancellationToken As CancellationToken = Nothing
) As TResult
abstract WithTransaction :
callback : Func<IClientSessionHandle, CancellationToken, 'TResult> *
?transactionOptions : TransactionOptions *
?cancellationToken : CancellationToken
(* Defaults:
let _transactionOptions = defaultArg transactionOptions null
let _cancellationToken = defaultArg cancellationToken new CancellationToken()
*)
-> 'TResult
Parameters
- callback
- Type: SystemFuncIClientSessionHandle, CancellationToken, TResult
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:
TResultThe callback result.
See Also