public sealed class DirectedReadOptions : IMessage<DirectedReadOptions>, IEquatable<DirectedReadOptions>, IDeepCloneable<DirectedReadOptions>, IBufferMessage, IMessage
Reference documentation and code samples for the Google Cloud Spanner v1 API class DirectedReadOptions.
The DirectedReadOptions can be used to indicate which replicas or regions
should be used for non-transactional reads or queries.
DirectedReadOptions may only be specified for a read-only transaction,
otherwise the API will return an INVALID_ARGUMENT error.
public DirectedReadOptions.Types.ExcludeReplicas ExcludeReplicas { get; set; }
Exclude_replicas indicates that specified replicas should be excluded
from serving requests. Spanner will not route requests to the replicas
in this list.
public DirectedReadOptions.Types.IncludeReplicas IncludeReplicas { get; set; }
Include_replicas indicates the order of replicas (as they appear in
this list) to process the request. If auto_failover_disabled is set to
true and all replicas are exhausted without finding a healthy replica,
Spanner will wait for a replica in the list to become available, requests
may fail due to DEADLINE_EXCEEDED errors.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe latest version of the \u003ccode\u003eDirectedReadOptions\u003c/code\u003e class in the Google Cloud Spanner v1 API is \u003ccode\u003e5.0.0-beta05\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eDirectedReadOptions\u003c/code\u003e is a class that enables users to specify which replicas or regions should be used for non-transactional reads or queries.\u003c/p\u003e\n"],["\u003cp\u003eThe class \u003ccode\u003eDirectedReadOptions\u003c/code\u003e can only be used with read-only transactions and will return an \u003ccode\u003eINVALID_ARGUMENT\u003c/code\u003e error otherwise.\u003c/p\u003e\n"],["\u003cp\u003eThis class allows you to include or exclude specific replicas when processing requests using the \u003ccode\u003eIncludeReplicas\u003c/code\u003e and \u003ccode\u003eExcludeReplicas\u003c/code\u003e properties, respectively.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eDirectedReadOptions\u003c/code\u003e class implements several interfaces including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Google Cloud Spanner v1 API - Class DirectedReadOptions (5.1.0)\n\nVersion latestkeyboard_arrow_down\n\n- [5.1.0 (latest)](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.DirectedReadOptions)\n- [5.0.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/5.0.0/Google.Cloud.Spanner.V1.DirectedReadOptions)\n- [4.6.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.6.0/Google.Cloud.Spanner.V1.DirectedReadOptions)\n- [4.5.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.5.0/Google.Cloud.Spanner.V1.DirectedReadOptions)\n- [4.4.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.4.0/Google.Cloud.Spanner.V1.DirectedReadOptions)\n- [4.3.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.3.0/Google.Cloud.Spanner.V1.DirectedReadOptions)\n- [4.2.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.2.0/Google.Cloud.Spanner.V1.DirectedReadOptions)\n- [4.1.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.1.0/Google.Cloud.Spanner.V1.DirectedReadOptions)\n- [4.0.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.0.0/Google.Cloud.Spanner.V1.DirectedReadOptions)\n- [3.15.1](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.15.1/Google.Cloud.Spanner.V1.DirectedReadOptions)\n- [3.14.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.14.0/Google.Cloud.Spanner.V1.DirectedReadOptions)\n- [3.13.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.13.0/Google.Cloud.Spanner.V1.DirectedReadOptions)\n- [3.12.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.12.0/Google.Cloud.Spanner.V1.DirectedReadOptions)\n- [3.11.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.11.0/Google.Cloud.Spanner.V1.DirectedReadOptions)\n- [3.10.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.10.0/Google.Cloud.Spanner.V1.DirectedReadOptions)\n- [3.9.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.9.0/Google.Cloud.Spanner.V1.DirectedReadOptions)\n- [3.8.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.8.0/Google.Cloud.Spanner.V1.DirectedReadOptions)\n- [3.7.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.7.0/Google.Cloud.Spanner.V1.DirectedReadOptions)\n- [3.6.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.6.0/Google.Cloud.Spanner.V1.DirectedReadOptions)\n- [3.5.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.5.0/Google.Cloud.Spanner.V1.DirectedReadOptions) \n\n public sealed class DirectedReadOptions : IMessage\u003cDirectedReadOptions\u003e, IEquatable\u003cDirectedReadOptions\u003e, IDeepCloneable\u003cDirectedReadOptions\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Google Cloud Spanner v1 API class DirectedReadOptions.\n\nThe DirectedReadOptions can be used to indicate which replicas or regions\nshould be used for non-transactional reads or queries.\n\nDirectedReadOptions may only be specified for a read-only transaction,\notherwise the API will return an `INVALID_ARGUMENT` error. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e DirectedReadOptions \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[DirectedReadOptions](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.DirectedReadOptions), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[DirectedReadOptions](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.DirectedReadOptions), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[DirectedReadOptions](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.DirectedReadOptions), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Spanner.V1](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.Spanner.V1.dll\n\nConstructors\n------------\n\n### DirectedReadOptions()\n\n public DirectedReadOptions()\n\n### DirectedReadOptions(DirectedReadOptions)\n\n public DirectedReadOptions(DirectedReadOptions other)\n\nProperties\n----------\n\n### ExcludeReplicas\n\n public DirectedReadOptions.Types.ExcludeReplicas ExcludeReplicas { get; set; }\n\nExclude_replicas indicates that specified replicas should be excluded\nfrom serving requests. Spanner will not route requests to the replicas\nin this list.\n\n### IncludeReplicas\n\n public DirectedReadOptions.Types.IncludeReplicas IncludeReplicas { get; set; }\n\nInclude_replicas indicates the order of replicas (as they appear in\nthis list) to process the request. If auto_failover_disabled is set to\ntrue and all replicas are exhausted without finding a healthy replica,\nSpanner will wait for a replica in the list to become available, requests\nmay fail due to `DEADLINE_EXCEEDED` errors.\n\n### ReplicasCase\n\n public DirectedReadOptions.ReplicasOneofCase ReplicasCase { get; }"]]