Example #1
0
        public virtual async Task <Response> MergeAsync(IDictionary <string, object> entity, string eTag = null, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(entity, nameof(entity));

            //TODO: Create Resource strings
            if (!entity.TryGetValue(TableConstants.PropertyNames.PartitionKey, out var partitionKey))
            {
                throw new ArgumentException("The entity must contain a PartitionKey value", nameof(entity));
            }

            if (!entity.TryGetValue(TableConstants.PropertyNames.RowKey, out var rowKey))
            {
                throw new ArgumentException("The entity must contain a RowKey value", nameof(entity));
            }

            return((await _tableOperations.MergeEntityAsync(_table,
                                                            partitionKey as string,
                                                            rowKey as string,
                                                            tableEntityProperties: entity.ToOdataAnnotatedDictionary(),
                                                            ifMatch: eTag,
                                                            queryOptions: new QueryOptions()
            {
                Format = _format
            },
                                                            cancellationToken: cancellationToken).ConfigureAwait(false)).GetRawResponse());
        }