# Google Cloud Spanner v1 API - Class ReadOrQueryRequest (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

    public sealed class ReadOrQueryRequest

Reference documentation and code samples for the Google Cloud Spanner v1 API class ReadOrQueryRequest.

Class for common properties of [ReadRequest](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadOrQueryRequest#Google_Cloud_Spanner_V1_ReadOrQueryRequest_ReadRequest) and [ExecuteSqlRequest](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadOrQueryRequest#Google_Cloud_Spanner_V1_ReadOrQueryRequest_ExecuteSqlRequest).

## Inheritance

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

## Inherited Members

[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.Spanner.V1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1)

## Assembly

Google.Cloud.Spanner.V1.dll

## Properties

### DataBoostEnabled

    public bool DataBoostEnabled { get; set; }

See [DataBoostEnabled](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadRequest#Google_Cloud_Spanner_V1_ReadRequest_DataBoostEnabled) and [DataBoostEnabled](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ExecuteSqlRequest#Google_Cloud_Spanner_V1_ExecuteSqlRequest_DataBoostEnabled)

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

### DirectedReadOptions

    public DirectedReadOptions DirectedReadOptions { get; set; }

See [DirectedReadOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadRequest#Google_Cloud_Spanner_V1_ReadRequest_DirectedReadOptions) and [DirectedReadOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ExecuteSqlRequest#Google_Cloud_Spanner_V1_ExecuteSqlRequest_DirectedReadOptions)

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

### ExecuteSqlRequest

    public ExecuteSqlRequest ExecuteSqlRequest { get; }

The underlying ExecuteSqlRequest if this is a query, and null otherwise.

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

### IsQuery

    public bool IsQuery { get; }

True if this is query, and false otherwise.

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

### IsRead

    public bool IsRead { get; }

True if this is a read, and false otherwise.

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

### PartitionToken

    public ByteString PartitionToken { get; set; }

See [PartitionToken](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadRequest#Google_Cloud_Spanner_V1_ReadRequest_PartitionToken) and [PartitionToken](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ExecuteSqlRequest#Google_Cloud_Spanner_V1_ExecuteSqlRequest_PartitionToken)

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.ByteString.html` |   |

### ReadRequest

    public ReadRequest ReadRequest { get; }

The underlying ReadRequest if this is a read, and null otherwise.

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

### ResumeToken

    public ByteString ResumeToken { set; }

See [ResumeToken](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadRequest#Google_Cloud_Spanner_V1_ReadRequest_ResumeToken) and [ResumeToken](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ExecuteSqlRequest#Google_Cloud_Spanner_V1_ExecuteSqlRequest_ResumeToken)

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.ByteString.html` |   |

### Session

    public string Session { get; }

See [Session](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.Session) and [Session](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.Session)

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

### SessionAsSessionName

    public SessionName SessionAsSessionName { set; }

See [Session](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.Session) and [Session](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.Session)

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

### Transaction

    public TransactionSelector Transaction { get; set; }

See [Transaction](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadRequest#Google_Cloud_Spanner_V1_ReadRequest_Transaction) and [Transaction](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ExecuteSqlRequest#Google_Cloud_Spanner_V1_ExecuteSqlRequest_Transaction)

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

## Methods

### CloneRequest()

    public ReadOrQueryRequest CloneRequest()

See Google.Cloud.Spanner.V1.ReadRequest.Clone() and Google.Cloud.Spanner.V1.ExecuteSqlRequest.Clone()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadOrQueryRequest` |   |

### ExecuteReadOrQueryStreamReader(PooledSession, CallSettings)

    public ReliableStreamReader ExecuteReadOrQueryStreamReader(PooledSession session, CallSettings callSettings)

Creates a [ReliableStreamReader](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReliableStreamReader) for this request

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `session` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.PooledSession` The session to use for the request. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReliableStreamReader` | A [ReliableStreamReader](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReliableStreamReader) for this request. |

### FromQueryRequest(ExecuteSqlRequest)

    public static ReadOrQueryRequest FromQueryRequest(ExecuteSqlRequest request)

Creates a new ReadOrQueryRequest from an ExecuteSqlRequest.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ExecuteSqlRequest` The request to wrap in a generic ReadOrQueryRequest |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadOrQueryRequest` | A new ReadOrQueryRequest that wraps the given request |

### FromReadRequest(ReadRequest)

    public static ReadOrQueryRequest FromReadRequest(ReadRequest request)

Creates a new ReadOrQueryRequest from an ReadRequest.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadRequest` The request to wrap in a generic ReadOrQueryRequest |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.ReadOrQueryRequest` | A new ReadOrQueryRequest that wraps the given request |

### GetCallSettings(SpannerSettings)

    public CallSettings GetCallSettings(SpannerSettings spannerSettings)

Extracts the corresponding CallSettings for the read or query request from the SpannerSettings.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `spannerSettings` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.SpannerSettings` The SpannerSettings to extract the CallSettings from |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` | The CallSettings to use for the request |

### GetHashCode()

    public override int GetHashCode()

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

**Overrides** [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)

### ToByteString()

    public ByteString ToByteString()

Returns a ByteString representation of this request.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.ByteString.html` |   |

### ToPartitionReadOrQueryRequest(long?, long?)

    public PartitionReadOrQueryRequest ToPartitionReadOrQueryRequest(long? partitionSizeBytes, long? maxPartitions)

Creates a PartitionReadOrQueryRequest from a ReadOrQueryRequest.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `partitionSizeBytes` | `https://learn.microsoft.com/dotnet/api/system.int64` |
| `maxPartitions` | `https://learn.microsoft.com/dotnet/api/system.int64` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.PartitionReadOrQueryRequest` | A new PartitionReadOrQueryRequest with the properties of the given request |