public async Task <T> SaveAsync(T entity) { entity.PartitionKey = entity.PartitionKey ?? entity.RowKey; entity.PartitionKey = usePartitionKeyService ? PartitionKeyService.Get(entity.RowKey) : entity.PartitionKey; TableOperation insertOperation = TableOperation.InsertOrMerge(entity); TableResult result = await table.ExecuteAsync(insertOperation); return(result.Result as T); }
public async Task <T> GetAsync(string rowKey, string partitionKey = null) { var pk = partitionKey ?? rowKey; pk = usePartitionKeyService ? PartitionKeyService.Get(rowKey) : pk; TableOperation readOperation = TableOperation.Retrieve <T>(pk, rowKey); TableResult result = await table.ExecuteAsync(readOperation); return(result.Result as T); }