Class RemoteTransaction
A controller for a remote transaction that is constructed from
g.Tx()
. Calling Begin()
on
this object will produce a new GraphTraversalSource
that is bound to a remote transaction over which
multiple traversals may be executed in that context. Calling CommitAsync()
or
RollbackAsync()
will then close the transaction and thus, the session. This feature only works with
transaction enabled graphs.
public class RemoteTransaction
- Inheritance
-
RemoteTransaction
- Inherited Members
Constructors
RemoteTransaction(IRemoteConnection, GraphTraversalSource)
Initializes a new instance of the RemoteTransaction class.
public RemoteTransaction(IRemoteConnection connection, GraphTraversalSource g)
Parameters
connection
IRemoteConnectionThe session bound connection that will be used to control this transaction.
g
GraphTraversalSourceThe graph traversal source from which a session bound traversal source will be created.
Methods
Begin()
Spawns a GraphTraversalSource that is bound to a remote session which enables a transaction.
public GraphTraversalSource Begin()
Returns
- GraphTraversalSource
A GraphTraversalSource bound to a remote session.
Exceptions
- InvalidOperationException
Thrown if this transaction is already bound to a session.
CommitAsync(CancellationToken)
Commits the transaction.
public Task CommitAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe token to cancel the operation. The default value is None.
Returns
RollbackAsync()
Rolls back the transaction.
public Task RollbackAsync()