Google.Cloud.Spanner.Data - Class SpannerTransactionOptions (5.0.0-beta06)

public sealed class SpannerTransactionOptions

Reference documentation and code samples for the Google.Cloud.Spanner.Data class SpannerTransactionOptions.

Options that may be applied to a transaction after creation, usually before committing the transaction or before executing the first transactional statement.

Inheritance

object > SpannerTransactionOptions

Namespace

Google.Cloud.Spanner.Data

Assembly

Google.Cloud.Spanner.Data.dll

Remarks

As opposed to SpannerTransactionCreationOptions, instances of this class are mutable. This is useful for ORM and similar implementations that depend on ADO.NET for transaction and command creation, which does not know about these Spanner specific options. These implementations may still access transaction and commands after creation and change these options.

Constructors

SpannerTransactionOptions()

public SpannerTransactionOptions()

Creates an instance of SpannerTransactionOptions with default values.

SpannerTransactionOptions(SpannerTransactionOptions)

public SpannerTransactionOptions(SpannerTransactionOptions other)

Creates an instance of SpannerTransactionOptions with the same values as other.

Parameter
Name Description
other SpannerTransactionOptions

The options to create this instance from. Must not be null.

Properties

CommitPriority

public Priority? CommitPriority { get; set; }

The priority to use for the Commit() and similar overloads. For command execution priority, use Priority. This value will be ignored by read-only transactions.

Property Value
Type Description
Priority

CommitTimeout

public int? CommitTimeout { get; set; }

The wait time, in seconds, before terminating the attempt to Commit() or Rollback() and generating an error. May be null, in which case, a transaction using these options will default to the commit timeout defined on its connection string. A value of '0' normally indicates that no timeout should be used (wait an infinite amount of time). However, if you specify AllowImmediateTimeouts=true in the connection string, '0' will cause a timeout that expires immediately. This is normally used only for testing purposes.

Property Value
Type Description
int

DisposeBehavior

public DisposeBehavior DisposeBehavior { get; set; }

Specifies how resources are treated when Dispose(bool) is called. Defaults to Default. For a pooled transaction, Default will cause transactional resources to be sent back into a shared pool for re-use. For a detached transaction the default behaviour is to do nothing with transactional resources. If set to CloseResources all transactional resource will be closed. A detached transaction must have one process choose CloseResources to avoid leaks of transactional resources. Changes to this value will be ignored after the transaction has been disposed.

Property Value
Type Description
DisposeBehavior

LogCommitStats

public bool? LogCommitStats { get; set; }

Specifies whether this transaction should request commit statistics from the backend and log these. If unset, the value set on the SpannerConnection of this transaction will be used.

Property Value
Type Description
bool

MaxCommitDelay

public TimeSpan? MaxCommitDelay { get; set; }

The maximum amount of time the commit may be delayed server side for batching with other commits. The bigger the delay, the better the throughput (QPS), but at the expense of commit latency. If set to Zero, commit batching is disabled. May be null, in which case commits will continue to be batched as they had been before this configuration option was made available to Spanner API consumers. May be set to any value between Zero and 500ms. Cannot be modified after commit or rollback has been called on the transaction.

Property Value
Type Description
TimeSpan

Tag

public string Tag { get; set; }

The transaction tag to use for SpannerTransaction This value will be ignored by read-only transactions. Changes to this value will be ignored by the transaction after it has executed statements.

Property Value
Type Description
string