Beispiel #1
0
        private async Task <CrossClientCashoutAggregate> TryGetAsync(Guid operationId)
        {
            var partitionKey = CrossClientCashoutEntity.GetPartitionKey(operationId);
            var rowKey       = CrossClientCashoutEntity.GetRowKey(operationId);

            var entity = await _storage.GetDataAsync(partitionKey, rowKey);

            return(entity?.ToDomain());
        }
Beispiel #2
0
        public async Task <CrossClientCashoutAggregate> GetOrAddAsync(Guid operationId, Func <CrossClientCashoutAggregate> newAggregateFactory)
        {
            var partitionKey = CrossClientCashoutEntity.GetPartitionKey(operationId);
            var rowKey       = CrossClientCashoutEntity.GetRowKey(operationId);

            var startedEntity = await _storage.GetOrInsertAsync(
                partitionKey,
                rowKey,
                () =>
            {
                var newAggregate = newAggregateFactory();

                return(CrossClientCashoutEntity.FromDomain(newAggregate));
            });

            return(startedEntity.ToDomain());
        }
Beispiel #3
0
        public async Task SaveAsync(CrossClientCashoutAggregate aggregate)
        {
            var entity = CrossClientCashoutEntity.FromDomain(aggregate);

            await _storage.ReplaceAsync(entity);
        }