コード例 #1
0
        /// <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);
        }
コード例 #2
0
        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
        }
コード例 #3
0
        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
        }
コード例 #4
0
        /// <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
        }
コード例 #5
0
        /// <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
        }