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.
Inherited Members
Namespace: Gremlin.Net.Process.Remote
Assembly: Gremlin.Net.dll
Syntax
public class RemoteTransaction
Constructors
RemoteTransaction(IRemoteConnection, GraphTraversalSource)
Initializes a new instance of the RemoteTransaction class.
Declaration
public RemoteTransaction(IRemoteConnection connection, GraphTraversalSource g)
Parameters
| Type | Name | Description |
|---|---|---|
| IRemoteConnection | connection | The session bound connection that will be used to control this transaction. |
| GraphTraversalSource | g | The 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.
Declaration
public GraphTraversalSource Begin()
Returns
| Type | Description |
|---|---|
| GraphTraversalSource | A GraphTraversalSource bound to a remote session. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown if this transaction is already bound to a session. |
CommitAsync(CancellationToken)
Commits the transaction.
Declaration
public Task CommitAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
| Type | Description |
|---|---|
| Task |
RollbackAsync()
Rolls back the transaction.
Declaration
public Task RollbackAsync()
Returns
| Type | Description |
|---|---|
| Task |