public async Task InsertAsync(IPaymentTransaction paymentTransaction) { var commonEntity = Mapper.Map <PaymentTransactionEntity>(paymentTransaction); commonEntity.PartitionKey = PaymentTransactionEntity.GeneratePartitionKey(); await _tableStorage.InsertAndGenerateRowKeyAsDateTimeAsync(commonEntity, paymentTransaction.Created); var entityByClient = Mapper.Map <PaymentTransactionEntity>(paymentTransaction); entityByClient.PartitionKey = PaymentTransactionEntity.GeneratePartitionKey(paymentTransaction.ClientId); entityByClient.RowKey = PaymentTransactionEntity.GenerateRowKey(paymentTransaction.Id); var index = AzureMultiIndex.Create(IndexPartitionKey, paymentTransaction.Id, commonEntity, entityByClient); await Task.WhenAll( _tableStorage.InsertAsync(entityByClient), _tableStorageIndices.InsertAsync(index) ); }
public async Task CreateAsync(IPaymentTransaction src) { var commonEntity = PaymentTransactionEntity.Create(src); commonEntity.PartitionKey = PaymentTransactionEntity.IndexCommon.GeneratePartitionKey(); await _tableStorage.InsertAndGenerateRowKeyAsDateTimeAsync(commonEntity, src.Created); var entityByClient = PaymentTransactionEntity.Create(src); entityByClient.PartitionKey = PaymentTransactionEntity.IndexByClient.GeneratePartitionKey(src.ClientId); entityByClient.RowKey = PaymentTransactionEntity.IndexByClient.GenerateRowKey(src.Id); var index = AzureMultiIndex.Create(IndexPartitinKey, src.Id, commonEntity, entityByClient); await Task.WhenAll( _tableStorage.InsertAsync(entityByClient), _tableStorageIndices.InsertAsync(index) ); }