private static (string PartitionKey, string RowKey) GetByToIndexKeys( TransactionReceiptEntity receipt) { return(GetByAddressIndexKeys ( blockNumber: receipt.BlockNumber, indexAddress: receipt.To, nonIndexAddress: receipt.From, hash: receipt.Hash, index: receipt.Index )); }
public async Task InsertOrReplaceAsync( TransactionReceipt receipt) { var receiptEntityKeys = GetReceiptKeys(receipt); var receiptEntity = new TransactionReceiptEntity { Amount = receipt.Amount, BlockNumber = receipt.BlockNumber, From = receipt.From, Hash = receipt.Hash, Index = receipt.Index, TransactionTimestamp = receipt.Timestamp, To = receipt.To, PartitionKey = receiptEntityKeys.PartitionKey, RowKey = receiptEntityKeys.RowKey }; var byFromIndexKeys = GetByFromIndexKeys(receipt); var indexByFrom = AzureIndex.Create ( byFromIndexKeys.PartitionKey, byFromIndexKeys.RowKey, receiptEntity ); var byToIndexKeys = GetByToIndexKeys(receipt); var byToIndex = AzureIndex.Create ( byToIndexKeys.PartitionKey, byToIndexKeys.RowKey, receiptEntity ); var byBlockIndexKeys = GetByBlockIndexKeys(receipt); var byBlockIndex = AzureIndex.Create ( byBlockIndexKeys.PartitionKey, byBlockIndexKeys.RowKey, receiptEntity ); await Task.WhenAll ( _transactionReceipts.InsertOrReplaceAsync(receiptEntity), _byFromIndices.InsertOrReplaceAsync(indexByFrom), _byToIndices.InsertOrReplaceAsync(byToIndex), _byBlockIndices.InsertOrReplaceAsync(byBlockIndex) ); }