public async Task <bool> DeleteAsync(string assetPair, DateTime dateTime) { var pkey = MatrixEntity.GeneratePartitionKey(assetPair, dateTime); var rowkey = MatrixEntity.GenerateRowKey(dateTime); var result = await _storage.DeleteIfExistAsync(pkey, rowkey); await _blobRepository.DeleteIfExistsAsync(assetPair, dateTime); return(result); }
private async Task <IEnumerable <MatrixEntity> > GetAsync(string assetPair, DateTime from, DateTime to) { Debug.Assert(!string.IsNullOrWhiteSpace(assetPair)); var pKeyFrom = MatrixEntity.GeneratePartitionKey(assetPair, from); var pKeyTo = MatrixEntity.GeneratePartitionKey(assetPair, to); var rowKeyFrom = MatrixEntity.GenerateRowKey(from); var rowKeyTo = MatrixEntity.GenerateRowKey(to); var query = new TableQuery <MatrixEntity>(); var pkeyCondFrom = TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.GreaterThanOrEqual, pKeyFrom); var pkeyCondTo = TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.LessThanOrEqual, pKeyTo); var pkeyFilter = TableQuery.CombineFilters(pkeyCondFrom, TableOperators.And, pkeyCondTo); var rowkeyCondFrom = TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.GreaterThanOrEqual, rowKeyFrom); var rowkeyCondTo = TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.LessThanOrEqual, rowKeyTo); var rowkeyFilter = TableQuery.CombineFilters(rowkeyCondFrom, TableOperators.And, rowkeyCondTo); query.FilterString = TableQuery.CombineFilters(pkeyFilter, TableOperators.And, rowkeyFilter); return(await _storage.WhereAsync(query)); }