Example #1
0
        public virtual Response Merge(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(_tableOperations.MergeEntity(_table,
                                                partitionKey as string,
                                                rowKey as string,
                                                tableEntityProperties: entity.ToOdataAnnotatedDictionary(),
                                                ifMatch: eTag,
                                                queryOptions: new QueryOptions()
            {
                Format = _format
            },
                                                cancellationToken: cancellationToken).GetRawResponse());
        }