Example #1
0
 internal async Task <Response> UpdateInternalAsync(bool async, string partitionKey, string rowKey, IDictionary <string, object> entity, CancellationToken cancellationToken = default)
 {
     if (async)
     {
         return(await _tableOperations.UpdateEntityAsync(_table,
                                                         partitionKey,
                                                         rowKey,
                                                         tableEntityProperties : entity,
                                                         queryOptions : new QueryOptions()
         {
             Format = _format
         },
                                                         cancellationToken : cancellationToken).ConfigureAwait(false));
     }
     else
     {
         return(_tableOperations.UpdateEntity(_table,
                                              partitionKey,
                                              rowKey,
                                              tableEntityProperties: entity,
                                              queryOptions: new QueryOptions()
         {
             Format = _format
         },
                                              cancellationToken: cancellationToken));
     }
 }
Example #2
0
        public virtual async Task <Response> UpsertAsync(IDictionary <string, object> entity, CancellationToken cancellationToken = default)
        {
            //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.UpdateEntityAsync(_table,
                                                            partitionKey as string,
                                                            rowKey as string,
                                                            tableEntityProperties : entity,
                                                            queryOptions : new QueryOptions()
            {
                Format = _format
            },
                                                            cancellationToken : cancellationToken).ConfigureAwait(false));
        }