public async Task <CashoutRiskControlAggregate> GetOrAddAsync(Guid operationId, Func <CashoutRiskControlAggregate> newAggregateFactory) { var partitionKey = CashoutRiskControlEntity.GetPartitionKey(operationId); var rowKey = CashoutRiskControlEntity.GetRowKey(); var startedEntity = await _storage.GetOrInsertAsync( partitionKey, rowKey, () => { var newAggregate = newAggregateFactory(); return(CashoutRiskControlEntity.FromDomain(newAggregate)); }); return(startedEntity.ToDomain()); }
public async Task SaveAsync(CashoutRiskControlAggregate aggregate) { var entity = CashoutRiskControlEntity.FromDomain(aggregate); await _storage.ReplaceAsync(entity); }