4.6.0 (latest) 4.5.0 4.4.0 4.3.0 4.2.0 4.1.0 4.0.0 3.13.0 3.12.0 3.11.0 3.10.0 3.9.0 3.8.0 3.7.0 3.6.0 3.5.1 3.4.0 3.3.0 3.2.0 3.1.0 3.0.0 2.5.0 2.4.0 2.3.1

    public sealed class TransactionOptions

Reference documentation and code samples for the Firestore API class TransactionOptions.

Immutable class representing options for executing transactions.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> TransactionOptions

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.Firestore](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore)

## Assembly

Google.Cloud.Firestore.dll

## Properties

### Default

    public static TransactionOptions Default { get; }

The transaction options that are used if nothing is specified by the caller.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.TransactionOptions` |   |

### MaxAttempts

    public int MaxAttempts { get; }

The number of times the transaction will be attempted before failing.
This is equivalent to [MaxAttempts](https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.RetrySettings.html#Google_Api_Gax_Grpc_RetrySettings_MaxAttempts).

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` |   |

### RetrySettings

    public RetrySettings RetrySettings { get; }

The settings to control the timing of retries within the transaction.
The [RetryFilter](https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.RetrySettings.html#Google_Api_Gax_Grpc_RetrySettings_RetryFilter) property is ignored. This property is never null.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.RetrySettings.html` |   |

## Methods

### ForMaxAttempts(int)

    public static TransactionOptions ForMaxAttempts(int maxAttempts)

Creates an instance with the given maximum number of attempts. The default retry
timing will be used.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `maxAttempts` | `https://learn.microsoft.com/dotnet/api/system.int32` The number of times a transaction will be attempted before failing. Must be positive. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.TransactionOptions` | A new options object. |

### ForRetrySettings(RetrySettings)

    public static TransactionOptions ForRetrySettings(RetrySettings retrySettings)

Creates an instance with the given retry settings, including maximum number of attempts.
The [RetryFilter](https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.RetrySettings.html#Google_Api_Gax_Grpc_RetrySettings_RetryFilter) property is not used.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `retrySettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.RetrySettings.html` The retry settings to use. Must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.TransactionOptions` | A new options object. |