public async Task <CashoutsBatchAggregate> TryGetAsync(Guid batchId) { var partitionKey = CashoutsBatchEntity.GetPartitionKey(batchId); var rowKey = CashoutsBatchEntity.GetRowKey(batchId); var entity = await _storage.GetDataAsync(partitionKey, rowKey); return(entity?.ToDomain()); }
public async Task <CashoutsBatchAggregate> GetOrAddAsync(Guid batchId, Func <CashoutsBatchAggregate> newAggregateFactory) { var partitionKey = CashoutsBatchEntity.GetPartitionKey(batchId); var rowKey = CashoutsBatchEntity.GetRowKey(batchId); var startedEntity = await _storage.GetOrInsertAsync( partitionKey, rowKey, () => { var newAggregate = newAggregateFactory(); return(CashoutsBatchEntity.FromDomain(newAggregate)); }); return(startedEntity.ToDomain()); }
public async Task SaveAsync(CashoutsBatchAggregate aggregate) { var entity = CashoutsBatchEntity.FromDomain(aggregate); await _storage.ReplaceAsync(entity); }