Class Transactions
A class for running transactional operations against a Couchbase Cluster.
Inherited Members
Namespace: Couchbase.Integrated.Transactions
Assembly: Couchbase.NetClient.dll
Syntax
[InterfaceStability(Level.Volatile)]
public class Transactions : IDisposable, IAsyncDisposable
Fields
| Edit this page View SourceOpRetryDelay
A standard delay between retried operations.
Declaration
public static readonly TimeSpan OpRetryDelay
Field Value
Type | Description |
---|---|
TimeSpan |
Properties
| Edit this page View SourceConfig
Gets the TransactionConfig to apply to all transaction runs from this instance.
Declaration
public TransactionConfig Config { get; }
Property Value
Type | Description |
---|---|
TransactionConfig |
Methods
| Edit this page View SourceDispose()
Declaration
public void Dispose()
Dispose(bool)
Dispose with the Disposing pattern.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | The Disposing pattern. |
DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
Declaration
public ValueTask DisposeAsync()
Returns
Type | Description |
---|---|
ValueTask |
QueryAsync<T>(string, PerTransactionConfig?, TransactionQueryOptions?, IScope?)
Run a single query as a transaction.
Declaration
public Task<SingleQueryTransactionResult<T>> QueryAsync<T>(string statement, PerTransactionConfig? config = null, TransactionQueryOptions? options = null, IScope? scope = null)
Parameters
Type | Name | Description |
---|---|---|
string | statement | The statement to execute. |
PerTransactionConfig | config | The configuration to use for this transaction. |
TransactionQueryOptions | options | The query-specific options |
IScope | scope | The scope |
Returns
Type | Description |
---|---|
Task<SingleQueryTransactionResult<T>> | A SingleQueryTransactionResult<T> with the query results, if any. |
Type Parameters
Name | Description |
---|---|
T | The type of the result. Use object for queries with no results. |
RunAsync(Func<AttemptContext, Task>, PerTransactionConfig)
Run a transaction agains the cluster.
Declaration
public Task<TransactionResult> RunAsync(Func<AttemptContext, Task> transactionLogic, PerTransactionConfig perConfig)
Parameters
Type | Name | Description |
---|---|---|
Func<AttemptContext, Task> | transactionLogic | A func representing the transaction logic. All data operations should use the methods on the AttemptContext provided. Do not mix and match non-transactional data operations. |
PerTransactionConfig | perConfig | A config with values unique to this specific transaction. |
Returns
Type | Description |
---|---|
Task<TransactionResult> | The result of the transaction. |