示例#1
0
        async Task CreateOrUpdateInBatch(TransactionalBatch batch)
        {
            if (etag == null)
            {
                batch.CreateItemStream(ToStream(value));
            }
            else
            {
                var options = new TransactionalBatchItemRequestOptions
                {
                    IfMatchEtag = etag
                };
                batch.ReplaceItemStream(TransactionEntityId, ToStream(value), options);
            }

            var response = await batch.ExecuteAsync().ConfigureAwait(false);

            if (!response.IsSuccessStatusCode)
            {
                throw new Exception(response.ToString());
            }
            etag = response.Last().ETag;
        }
示例#2
0
 public override void Apply(TransactionalBatch transactionalBatch, PartitionKeyPath partitionKeyPath)
 {
     transactionalBatch.ReplaceItemStream(id, streamPayload, options);
 }