Show / Hide Table of Contents

# Interface ITransactionsClient

Ignite Thin Client transactions facade.

Transactions are bound to the thread started the transaction. After that, each cache operation within this thread will belong to the corresponding transaction until the transaction is committed, rolled back or closed.

Should not be used with async calls. You can use cache transactions as follows:

    using (var tx = igniteClient.GetTransactions().TxStart())
    {
        int v1 = cache<string, int>.Get("k1");

        // Check if v1 satisfies some condition before doing a put.
        if (v1 > 0)
            cache.Put<string, int>("k1", 2);

        cache.Remove("k2");

        // Commit the transaction.
        tx.Commit();
    }

Alternatively, System.Transactions.TransactionScope can be used to start Ignite transactions.

    using (var ts = new TransactionScope())
    {
        int v1 = cache<string, int>.Get("k1");

        // Check if v1 satisfies some condition before doing a put.
        if (v1 > 0)
            cache.Put<string, int>("k1", 2);

        cache.Remove("k2");

        // Commit the transaction.
        ts.Complete();
    }

###### Namespace: Apache.Ignite.Core.Client.Transactions

###### Assembly: Apache.Ignite.Core.dll

##### Syntax

    public interface ITransactionsClient

### Properties

#### DefaultTimeout

Gets the default transaction timeout.

##### Declaration

    TimeSpan DefaultTimeout { get; }

##### Property Value

Type | Description
--- | ---
System.TimeSpan |

#### DefaultTransactionConcurrency

Gets the default transaction concurrency.

##### Declaration

    TransactionConcurrency DefaultTransactionConcurrency { get; }

##### Property Value

Type | Description
--- | ---
TransactionConcurrency |

#### DefaultTransactionIsolation

Gets the default transaction isolation.

##### Declaration

    TransactionIsolation DefaultTransactionIsolation { get; }

##### Property Value

Type | Description
--- | ---
TransactionIsolation |

#### Tx

Gets transaction started by this thread or null if this thread does not have a transaction.

##### Declaration

    ITransactionClient Tx { get; }

##### Property Value

Type | Description
--- | ---
ITransactionClient | Transaction started by this thread or null if this thread does not have a transaction.

### Methods

#### TxStart()

Starts a new transaction with the default isolation level, concurrency and timeout.

Default values for transaction isolation level, concurrency and timeout can be configured via TransactionClientConfiguration.

Should not be used with async calls.

##### Declaration

    ITransactionClient TxStart()

##### Returns

Type | Description
--- | ---
ITransactionClient | New transaction.

#### TxStart(TransactionConcurrency, TransactionIsolation)

Starts a new transaction with the specified concurrency and isolation.

Should not be used with async calls.

##### Declaration

    ITransactionClient TxStart(TransactionConcurrency concurrency, TransactionIsolation isolation)

##### Parameters

Type | Name | Description
--- | --- | ---
TransactionConcurrency | concurrency | Concurrency.
TransactionIsolation | isolation | Isolation.

##### Returns

Type | Description
--- | ---
ITransactionClient | New transaction.

#### TxStart(TransactionConcurrency, TransactionIsolation, TimeSpan)

Starts a new transaction with the specified concurrency, isolation and timeout.

Should not be used with async calls.

##### Declaration

    ITransactionClient TxStart(TransactionConcurrency concurrency, TransactionIsolation isolation, TimeSpan timeout)

##### Parameters

Type | Name | Description
--- | --- | ---
TransactionConcurrency | concurrency | Concurrency.
TransactionIsolation | isolation | Isolation.
System.TimeSpan | timeout | Timeout. TimeSpan. Zero for indefinite timeout.

##### Returns

Type | Description
--- | ---
ITransactionClient | New transaction.

#### WithLabel(String)

Returns instance of ITransactionsClient to mark a transaction instance with a special label. The label is helpful for diagnostic and exposed to some diagnostic tools like SYS.TRANSACTIONS system view, control.sh commands, JMX TransactionsMXBean, long-running transactions dump in logs and Label via GetLocalActiveTransactions().

##### Declaration

    ITransactionsClient WithLabel(string label)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | label | Label.

##### Returns

Type | Description
--- | ---
ITransactionsClient | Apache.Ignite.Core.Client.Transactions.IClientTransactions