# Google.Cloud.Spanner.Data - Namespace Google.Cloud.Spanner.Data (5.13.0-beta07)

5.13.0-beta07 5.13.0-beta06 5.12.0 (latest) 5.11.0 5.10.0 5.9.0 5.8.0 5.7.0 5.6.0 5.5.0 5.4.0 5.3.0 5.2.0 5.1.0 5.0.0 4.6.0 4.5.0 4.4.0 4.3.0 4.2.0 4.1.0 4.0.0 3.15.1 3.14.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.0

## Classes

### [ClientContext](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.ClientContext)

Container for various pieces of client-owned context attached to a request.

### [CommandPartition](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.CommandPartition)

Represents a partition of data upon which a [SpannerCommand](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerCommand) will execute.
Partitions are useful for parallelizing large operations across several tasks or processes.

### [Key](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.Key)

Immutable class that defines a key for a single row in a table or index.

### [KeyRange](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.KeyRange)

Immutable class that defines a range of keys to select from a table or index.

### [KeySet](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.KeySet)

Immutable class that defines a set of keys to select from a table or index.
KeySets are used for Read operations to specify the rows that should be returned
by the read. A KeySet can be created from a set of individual keys or a set of
key ranges. The [All](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.KeySet#Google_Cloud_Spanner_Data_KeySet_All) instance can be used for read operations
that should return all rows.

### [PartitionOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.PartitionOptions)

Options used to create and read partitions.
Instances of this class are immutable so they can be freely reused.

### [QueryOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.QueryOptions)

Immutable class representing query options.

### [ReadOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.ReadOptions)

ReadOptions define a read operation for a Spanner table.

### [SessionPoolManager](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SessionPoolManager)

Manages sessions used by [SpannerConnection](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerConnection). This is rarely used
directly by user code; it's public to provide flexibility when custom options are
required.

### [SpannerBatchCommand](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerBatchCommand)

Represents batched commands to execute against a Spanner database.
Currently only DML commands are supported in batch mode.


You can create an instance of [SpannerBatchCommand](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerBatchCommand) with no
initial commands.
You can then add commands to a [SpannerBatchCommand](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerBatchCommand) using the
[Add(SpannerCommandTextBuilder, SpannerParameterCollection)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerBatchCommand#Google_Cloud_Spanner_Data_SpannerBatchCommand_Add_Google_Cloud_Spanner_Data_SpannerCommandTextBuilder_Google_Cloud_Spanner_Data_SpannerParameterCollection_) or
[Add(string, SpannerParameterCollection)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerBatchCommand#Google_Cloud_Spanner_Data_SpannerBatchCommand_Add_System_String_Google_Cloud_Spanner_Data_SpannerParameterCollection_) or [Add(SpannerCommand)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerBatchCommand#Google_Cloud_Spanner_Data_SpannerBatchCommand_Add_Google_Cloud_Spanner_Data_SpannerCommand_) methods.


For batched DML commands use [ExecuteNonQueryAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerBatchCommand#Google_Cloud_Spanner_Data_SpannerBatchCommand_ExecuteNonQueryAsync_System_Threading_CancellationToken_) or
[ExecuteNonQuery()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerBatchCommand#Google_Cloud_Spanner_Data_SpannerBatchCommand_ExecuteNonQuery) to execute the batched commands.

### [SpannerBatchNonQueryException](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerBatchNonQueryException)

Represents an error communicating with the Spanner database when executing
batch non query operations.

### [SpannerBatchWriteCommand](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerBatchWriteCommand)

Represents a batch of mutation groups to be executed against a Spanner database using the BatchWrite RPC.
Each group is applied atomically and independently of other groups.
Currently only Insert, Update, InsertOrUpdate, and Delete commands are supported in batch write mode.


You can create an instance of [SpannerBatchWriteCommand](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerBatchWriteCommand) with no
initial commands.
You can then add commands to a [SpannerBatchWriteCommand](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerBatchWriteCommand) using the
[Add(SpannerCommand, params SpannerCommand\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerBatchWriteCommand#Google_Cloud_Spanner_Data_SpannerBatchWriteCommand_Add_Google_Cloud_Spanner_Data_SpannerCommand_Google_Cloud_Spanner_Data_SpannerCommand___) or
[Add(IEnumerable\<SpannerCommand\>)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerBatchWriteCommand#Google_Cloud_Spanner_Data_SpannerBatchWriteCommand_Add_System_Collections_Generic_IEnumerable_Google_Cloud_Spanner_Data_SpannerCommand__) methods.


Use [ExecuteNonQueryAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerBatchWriteCommand#Google_Cloud_Spanner_Data_SpannerBatchWriteCommand_ExecuteNonQueryAsync_System_Threading_CancellationToken_).

### [SpannerBatchWriteCommand.BatchWriteResult](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerBatchWriteCommand.BatchWriteResult)

Represents the result of a single command group in a BatchWrite operation.

### [SpannerCommand](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerCommand)

Represents a SQL query or command to execute against
a Spanner database.
If the command is a SQL query, then [CommandText](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerCommand#Google_Cloud_Spanner_Data_SpannerCommand_CommandText)
contains the entire SQL statement. Use [ExecuteReaderAsync()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerCommand#Google_Cloud_Spanner_Data_SpannerCommand_ExecuteReaderAsync) to obtain results.

If the command is an update, insert or delete command, then [CommandText](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerCommand#Google_Cloud_Spanner_Data_SpannerCommand_CommandText)
is simply "\[operation\] \[spanner_table\]" such as "UPDATE MYTABLE" with the parameter
collection containing [SpannerParameter](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerParameter) instances whose name matches a column
in the target table. Use [ExecuteNonQueryAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerCommand#Google_Cloud_Spanner_Data_SpannerCommand_ExecuteNonQueryAsync_System_Threading_CancellationToken_) to execute the command.

The command may also be a DDL statement such as CREATE TABLE. Use [ExecuteNonQueryAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerCommand#Google_Cloud_Spanner_Data_SpannerCommand_ExecuteNonQueryAsync_System_Threading_CancellationToken_)
to execute a DDL statement.

### [SpannerCommandTextBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerCommandTextBuilder)

Builds the [CommandText](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerCommand#Google_Cloud_Spanner_Data_SpannerCommand_CommandText) string for executing a query or operation
on a Spanner database. Instances are constructed with static factory methods.

### [SpannerConnection](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerConnection)

Represents a connection to a single Spanner database.
When opened, [SpannerConnection](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerConnection) will acquire and maintain a session
with the target Spanner database.
[SpannerCommand](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerCommand) instances using this [SpannerConnection](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerConnection)
will use this session to execute their operation. Concurrent read operations can
share this session, but concurrent write operations may cause additional sessions
to be opened to the database.
Underlying sessions with the Spanner database are pooled and are closed after a
configurable

.

### [SpannerConnectionStringBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerConnectionStringBuilder)

A connection string builder for Spanner connection strings.
The connection string should be of the form:
Data Source=projects/{project}/instances/{instance}/databases/{database};\[Host={hostname};\]\[Port={portnumber}\]

### [SpannerDataAdapter](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDataAdapter)

Represents a set of data commands and a database connection that are used to fill the DataSet
and update a Spanner database.

### [SpannerDataReader](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDataReader)

Reads a forward-only stream of rows from a data source.

### [SpannerDbType](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerDbType)

Represents a Type that can be stored in a Spanner column or returned from a query.

### [SpannerException](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerException)

Represents an error communicating with the Spanner database.

### [SpannerParameter](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerParameter)

Represents a parameter to a [SpannerCommand](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerCommand) and optionally its mapping to DataSet columns.

### [SpannerParameterCollection](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerParameterCollection)

Represents a collection of parameters associated with a [SpannerCommand](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerCommand) and their
respective mappings to columns in a DataSet.

### [SpannerProviderFactory](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerProviderFactory)

Represents a set of methods for creating instances of the Spanner data provider's implementation of the data source classes.

### [SpannerRowUpdatedEventArgs](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerRowUpdatedEventArgs)

Provides data for the RowUpdated event of the Spanner data provider.

### [SpannerRowUpdatingEventArgs](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerRowUpdatingEventArgs)

Provides data for the RowUpdating event of the Spanner data provider.

### [SpannerStruct](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerStruct)

A struct parameter or returned value.

### [SpannerStruct.Field](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerStruct.Field)

A field within a struct.

### [SpannerTransaction](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerTransaction)

Represents a SQL transaction to be made in a Spanner database.
A transaction in Cloud Spanner is a set of reads and writes that execute
atomically at a single logical point in time across columns, rows, and
tables in a database.

### [SpannerTransactionBase](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerTransactionBase)

Base class for SpannerTransaction, used for compatibility purposes with [DbTransaction](https://learn.microsoft.com/dotnet/api/system.data.common.dbtransaction).
(This class is able to override a new method added to [DbTransaction](https://learn.microsoft.com/dotnet/api/system.data.common.dbtransaction), even if it clashes
with an existing method declaration in [SpannerTransaction](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerTransaction).)

### [SpannerTransactionCreationOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerTransactionCreationOptions)

Options that may be provided when creating a [SpannerTransaction](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerTransaction).
Instances of this class are immutable.

### [SpannerTransactionOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerTransactionOptions)

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

### [TimestampBound](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.TimestampBound)

Indicates how Spanner will choose a timestamp at which to read the data for read-only
transactions.

### [TransactionId](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.TransactionId)

A TransactionId holds identifying information about an active transaction in
Cloud Spanner. Since it is serializable, it enables you to send this information
to another process or machine so it may connect to the same transaction.

### [TransientFaultDetector](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.TransientFaultDetector)

Transactions can be retried using the Transient Fault Handling Application Block.
This extension helps you create a strategy that will detect transient faults when performing
transactions with Spanner.
To create an execution strategy, create a class

    class SpannerTransientErrorDetectionStrategy : ITransientErrorDetectionStrategy
    {
      public bool IsTransient(Exception ex) => ex.IsTransientSpannerFault();
    }

## Enums

### [DisposeBehavior](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.DisposeBehavior)

Defines the behavior of [SpannerTransaction](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerTransaction) when Dispose is called.
[DisposeBehavior](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerTransaction#Google_Cloud_Spanner_Data_SpannerTransaction_DisposeBehavior) for more information.

### [ErrorCode](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.ErrorCode)

A detailed code supplied via [ErrorCode](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerException#Google_Cloud_Spanner_Data_SpannerException_ErrorCode) when an error
occurs.

### [LockHint](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.LockHint)

Lock hint options for reads within a transaction.
See Google.Cloud.Spanner.V1.ReadRequest.Types.LockHint for details.

### [OrderBy](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.OrderBy)

Options for the order in which rows are returned from a read.
See Google.Cloud.Spanner.V1.ReadRequest.Types.OrderBy for details.

### [Priority](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.Priority)

The relative priority for requests.

### [ReadLockMode](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.ReadLockMode)

`ReadLockMode` is used to set the read lock mode for read-write
transactions executed on Spanner. See Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadWrite.Types.ReadLockMode for more details.

### [SpannerBatchCommandType](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerBatchCommandType)

Indicates the type of [SpannerBatchCommand](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerBatchCommand) that will be executed.

### [SpannerCommandType](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerCommandType)

Indicates the type of [SpannerCommand](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerCommand) that will be executed.

### [TimestampBoundMode](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.TimestampBoundMode)

Indicates how to choose the timestamp at which to read the data for Cloud Spanner read-only transactions.
If your application can tolerate some staleness when reading data, you can use a stale read,
which can execute much faster when compared to reading the latest data.

### [TransactionMode](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.TransactionMode)

Indicates the mode for the transaction.