When mode is TRANSACTIONAL, mutations affecting a single entity are
applied in order. The following sequences of mutations affecting a single
entity are not permitted in a single Commit request:
insert followed by insert
update followed by insert
upsert followed by insert
delete followed by update
When mode is NON_TRANSACTIONAL, no two mutations may affect a single
entity.
public TransactionOptions SingleUseTransaction { get; set; }
Options for beginning a new transaction for this request.
The transaction is committed when the request completes. If specified,
[TransactionOptions.mode][google.datastore.v1.TransactionOptions] must be
[TransactionOptions.ReadWrite][google.datastore.v1.TransactionOptions.ReadWrite].
The identifier of the transaction associated with the commit. A
transaction identifier is returned by a call to
[Datastore.BeginTransaction][google.datastore.v1.Datastore.BeginTransaction].
[[["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 latest version of the \u003ccode\u003eCommitRequest\u003c/code\u003e class for the Google Cloud Datastore V1 API is 4.15.0.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eCommitRequest\u003c/code\u003e class is used to define the request structure for the \u003ccode\u003eDatastore.Commit\u003c/code\u003e operation within the Google Cloud Datastore V1 API.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eCommitRequest\u003c/code\u003e implements interfaces such as \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e, enhancing its capabilities for message handling, comparison, and cloning.\u003c/p\u003e\n"],["\u003cp\u003eKey properties of the \u003ccode\u003eCommitRequest\u003c/code\u003e class include \u003ccode\u003eDatabaseId\u003c/code\u003e, \u003ccode\u003eMode\u003c/code\u003e, \u003ccode\u003eMutations\u003c/code\u003e, \u003ccode\u003eProjectId\u003c/code\u003e, \u003ccode\u003eSingleUseTransaction\u003c/code\u003e, and \u003ccode\u003eTransaction\u003c/code\u003e, allowing for detailed control over commit operations.\u003c/p\u003e\n"],["\u003cp\u003eThis class allows specifying the type of commit to perform, which defaults to transactional, and enables the user to define the mutations that must be carried out, with constraints on the order of operations for single entities.\u003c/p\u003e\n"]]],[],null,["# Google Cloud Datastore v1 API - Class CommitRequest (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.CommitRequest)\n- [4.14.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.14.0/Google.Cloud.Datastore.V1.CommitRequest)\n- [4.13.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.13.0/Google.Cloud.Datastore.V1.CommitRequest)\n- [4.12.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.12.0/Google.Cloud.Datastore.V1.CommitRequest)\n- [4.11.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.11.0/Google.Cloud.Datastore.V1.CommitRequest)\n- [4.10.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.10.0/Google.Cloud.Datastore.V1.CommitRequest)\n- [4.9.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.9.0/Google.Cloud.Datastore.V1.CommitRequest)\n- [4.8.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.8.0/Google.Cloud.Datastore.V1.CommitRequest)\n- [4.7.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.7.0/Google.Cloud.Datastore.V1.CommitRequest)\n- [4.6.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.6.0/Google.Cloud.Datastore.V1.CommitRequest)\n- [4.5.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.5.0/Google.Cloud.Datastore.V1.CommitRequest)\n- [4.4.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.4.0/Google.Cloud.Datastore.V1.CommitRequest)\n- [4.3.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.3.0/Google.Cloud.Datastore.V1.CommitRequest)\n- [4.2.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.2.0/Google.Cloud.Datastore.V1.CommitRequest)\n- [4.1.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.1.0/Google.Cloud.Datastore.V1.CommitRequest)\n- [4.0.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/4.0.0/Google.Cloud.Datastore.V1.CommitRequest)\n- [3.5.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/3.5.0/Google.Cloud.Datastore.V1.CommitRequest)\n- [3.4.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/3.4.0/Google.Cloud.Datastore.V1.CommitRequest)\n- [3.3.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/3.3.0/Google.Cloud.Datastore.V1.CommitRequest)\n- [3.2.0](/dotnet/docs/reference/Google.Cloud.Datastore.V1/3.2.0/Google.Cloud.Datastore.V1.CommitRequest) \n\n public sealed class CommitRequest : IMessage\u003cCommitRequest\u003e, IEquatable\u003cCommitRequest\u003e, IDeepCloneable\u003cCommitRequest\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Google Cloud Datastore v1 API class CommitRequest.\n\nThe request for \\[Datastore.Commit\\]\\[google.datastore.v1.Datastore.Commit\\]. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e CommitRequest \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[CommitRequest](/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequest), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[CommitRequest](/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequest), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[CommitRequest](/dotnet/docs/reference/Google.Cloud.Datastore.V1/latest/Google.Cloud.Datastore.V1.CommitRequest), [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### CommitRequest()\n\n public CommitRequest()\n\n### CommitRequest(CommitRequest)\n\n public CommitRequest(CommitRequest other)\n\nProperties\n----------\n\n### DatabaseId\n\n public string DatabaseId { get; set; }\n\nThe ID of the database against which to make the request.\n\n'(default)' is not allowed; please use empty string '' to refer the default\ndatabase.\n\n### HasTransaction\n\n public bool HasTransaction { get; }\n\nGets whether the \"transaction\" field is set\n\n### Mode\n\n public CommitRequest.Types.Mode Mode { get; set; }\n\nThe type of commit to perform. Defaults to `TRANSACTIONAL`.\n\n### Mutations\n\n public RepeatedField\u003cMutation\u003e Mutations { get; }\n\nThe mutations to perform.\n\nWhen mode is `TRANSACTIONAL`, mutations affecting a single entity are\napplied in order. The following sequences of mutations affecting a single\nentity are not permitted in a single `Commit` request:\n\n- `insert` followed by `insert`\n- `update` followed by `insert`\n- `upsert` followed by `insert`\n- `delete` followed by `update`\n\nWhen mode is `NON_TRANSACTIONAL`, no two mutations may affect a single\nentity.\n\n### ProjectId\n\n public string ProjectId { get; set; }\n\nRequired. The ID of the project against which to make the request.\n\n### SingleUseTransaction\n\n public TransactionOptions SingleUseTransaction { get; set; }\n\nOptions for beginning a new transaction for this request.\nThe transaction is committed when the request completes. If specified,\n\\[TransactionOptions.mode\\]\\[google.datastore.v1.TransactionOptions\\] must be\n\\[TransactionOptions.ReadWrite\\]\\[google.datastore.v1.TransactionOptions.ReadWrite\\].\n\n### Transaction\n\n public ByteString Transaction { get; set; }\n\nThe identifier of the transaction associated with the commit. A\ntransaction identifier is returned by a call to\n\\[Datastore.BeginTransaction\\]\\[google.datastore.v1.Datastore.BeginTransaction\\].\n\n### TransactionSelectorCase\n\n public CommitRequest.TransactionSelectorOneofCase TransactionSelectorCase { get; }"]]