示例#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());
        }
示例#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());
        }
示例#3
0
        public async Task SaveAsync(CrossClientCashoutAggregate aggregate)
        {
            var entity = CrossClientCashoutEntity.FromDomain(aggregate);

            await _storage.ReplaceAsync(entity);
        }