/// <inheritdoc /> public override async Task <CommitResponse> CommitAsync(CallSettings callSettings = null) { // TODO: What if there are no mutations? Just rollback? CheckActive(); var response = await _client.CommitAsync(_projectId, Mode.Transactional, TransactionId, _mutations, callSettings); _active = false; return(response); }
public async Task CommitAsync2() { // Snippet: CommitAsync(string,CommitRequest.Types.Mode,IEnumerable<Mutation>,CallSettings) // Additional: CommitAsync(string,CommitRequest.Types.Mode,IEnumerable<Mutation>,CancellationToken) // Create client DatastoreClient datastoreClient = DatastoreClient.Create(); // Initialize request argument(s) string projectId = ""; CommitRequest.Types.Mode mode = CommitRequest.Types.Mode.Unspecified; IEnumerable <Mutation> mutations = new List <Mutation>(); // Make the request CommitResponse response = await datastoreClient.CommitAsync(projectId, mode, mutations); // End snippet }
public async Task CommitAsync_RequestObject() { // Snippet: CommitAsync(CommitRequest,CallSettings) // Create client DatastoreClient datastoreClient = await DatastoreClient.CreateAsync(); // Initialize request argument(s) CommitRequest request = new CommitRequest { ProjectId = "", Mode = CommitRequest.Types.Mode.Unspecified, Mutations = { }, }; // Make the request CommitResponse response = await datastoreClient.CommitAsync(request); // End snippet }
/// <summary>Snippet for CommitAsync</summary> public async Task Commit1Async() { // Snippet: CommitAsync(string, CommitRequest.Types.Mode, ByteString, IEnumerable<Mutation>, CallSettings) // Additional: CommitAsync(string, CommitRequest.Types.Mode, ByteString, IEnumerable<Mutation>, CancellationToken) // Create client DatastoreClient datastoreClient = await DatastoreClient.CreateAsync(); // Initialize request argument(s) string projectId = ""; CommitRequest.Types.Mode mode = CommitRequest.Types.Mode.Unspecified; ByteString transaction = ByteString.Empty; IEnumerable <Mutation> mutations = new Mutation[] { new Mutation(), }; // Make the request CommitResponse response = await datastoreClient.CommitAsync(projectId, mode, transaction, mutations); // End snippet }
/// <summary>Snippet for CommitAsync</summary> public async Task CommitRequestObjectAsync() { // Snippet: CommitAsync(CommitRequest, CallSettings) // Additional: CommitAsync(CommitRequest, CancellationToken) // Create client DatastoreClient datastoreClient = await DatastoreClient.CreateAsync(); // Initialize request argument(s) CommitRequest request = new CommitRequest { Transaction = ByteString.Empty, Mode = CommitRequest.Types.Mode.Unspecified, Mutations = { new Mutation(), }, ProjectId = "", }; // Make the request CommitResponse response = await datastoreClient.CommitAsync(request); // End snippet }