public sealed class TransactionOptions : IMessage<TransactionOptions>, IEquatable<TransactionOptions>, IDeepCloneable<TransactionOptions>, IBufferMessage, IMessage
Reference documentation and code samples for the Google Cloud Datastore v1 API class TransactionOptions.
Options for beginning a new transaction.
Transactions can be created explicitly with calls to
[Datastore.BeginTransaction][google.datastore.v1.Datastore.BeginTransaction]
or implicitly by setting
[ReadOptions.new_transaction][google.datastore.v1.ReadOptions.new_transaction]
in read requests.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eTransactionOptions\u003c/code\u003e class in the Google Cloud Datastore v1 API provides settings for initiating new transactions, either explicitly or implicitly within read requests.\u003c/p\u003e\n"],["\u003cp\u003eThis class supports creating options for read-only transactions using \u003ccode\u003eCreateReadOnly()\u003c/code\u003e and read-write transactions using \u003ccode\u003eCreateReadWrite()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eCreateForRetry\u003c/code\u003e method allows creating options for retrying a previous transaction using a provided \u003ccode\u003epreviousTransactionId\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eTransactionOptions\u003c/code\u003e offers \u003ccode\u003eReadOnly\u003c/code\u003e and \u003ccode\u003eReadWrite\u003c/code\u003e properties to specify whether a transaction permits only reads or both reads and writes.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version available for \u003ccode\u003eTransactionOptions\u003c/code\u003e in the provided document is 4.15.0, with a range of versions going back to 3.2.0 for the public documented class.\u003c/p\u003e\n"]]],[],null,["# Google Cloud Datastore v1 API - Class TransactionOptions (4.15.0)\n\nVersion latestkeyboard_arrow_down\n\n- [4.15.0 (latest)](/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.TransactionOptions)\n- [4.14.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.14.0/Google.Cloud.Datastore.V1.TransactionOptions)\n- [4.13.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.13.0/Google.Cloud.Datastore.V1.TransactionOptions)\n- [4.12.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.12.0/Google.Cloud.Datastore.V1.TransactionOptions)\n- [4.11.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.11.0/Google.Cloud.Datastore.V1.TransactionOptions)\n- [4.10.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.10.0/Google.Cloud.Datastore.V1.TransactionOptions)\n- [4.9.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.9.0/Google.Cloud.Datastore.V1.TransactionOptions)\n- [4.8.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.8.0/Google.Cloud.Datastore.V1.TransactionOptions)\n- [4.7.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.7.0/Google.Cloud.Datastore.V1.TransactionOptions)\n- [4.6.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.6.0/Google.Cloud.Datastore.V1.TransactionOptions)\n- [4.5.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.5.0/Google.Cloud.Datastore.V1.TransactionOptions)\n- [4.4.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.4.0/Google.Cloud.Datastore.V1.TransactionOptions)\n- [4.3.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.3.0/Google.Cloud.Datastore.V1.TransactionOptions)\n- [4.2.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.2.0/Google.Cloud.Datastore.V1.TransactionOptions)\n- [4.1.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.1.0/Google.Cloud.Datastore.V1.TransactionOptions)\n- [4.0.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.0.0/Google.Cloud.Datastore.V1.TransactionOptions)\n- [3.5.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/3.5.0/Google.Cloud.Datastore.V1.TransactionOptions)\n- [3.4.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/3.4.0/Google.Cloud.Datastore.V1.TransactionOptions)\n- [3.3.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/3.3.0/Google.Cloud.Datastore.V1.TransactionOptions)\n- [3.2.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/3.2.0/Google.Cloud.Datastore.V1.TransactionOptions) \n\n public sealed class TransactionOptions : IMessage\u003cTransactionOptions\u003e, IEquatable\u003cTransactionOptions\u003e, IDeepCloneable\u003cTransactionOptions\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Google Cloud Datastore v1 API class TransactionOptions.\n\nOptions for beginning a new transaction.\n\nTransactions can be created explicitly with calls to\n\\[Datastore.BeginTransaction\\]\\[google.datastore.v1.Datastore.BeginTransaction\\]\nor implicitly by setting\n\\[ReadOptions.new_transaction\\]\\[google.datastore.v1.ReadOptions.new_transaction\\]\nin read requests. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e TransactionOptions \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[TransactionOptions](/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.TransactionOptions), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[TransactionOptions](/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.TransactionOptions), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[TransactionOptions](/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.TransactionOptions), [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.Datastore.V1](/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.Datastore.V1.dll\n\nConstructors\n------------\n\n### TransactionOptions()\n\n public TransactionOptions()\n\n### TransactionOptions(TransactionOptions)\n\n public TransactionOptions(TransactionOptions other)\n\nProperties\n----------\n\n### ModeCase\n\n public TransactionOptions.ModeOneofCase ModeCase { get; }\n\n### ReadOnly\n\n public TransactionOptions.Types.ReadOnly ReadOnly { get; set; }\n\nThe transaction should only allow reads.\n\n### ReadWrite\n\n public TransactionOptions.Types.ReadWrite ReadWrite { get; set; }\n\nThe transaction should allow both reads and writes.\n\nMethods\n-------\n\n### CreateForRetry(ByteString)\n\n public static TransactionOptions CreateForRetry(ByteString previousTransactionId)\n\nCreates options for a transaction that will retry a previous one, identified by `previousTransactionId`.\n\n### CreateReadOnly()\n\n public static TransactionOptions CreateReadOnly()\n\nCreates options for a read-only transaction.\n\n### CreateReadWrite()\n\n public static TransactionOptions CreateReadWrite()\n\nCreates options for a read-write transaction. (This is equivalent to not specifying transaction options at all.)"]]