コード例 #1
0
        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());
        }
コード例 #2
0
        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());
        }
コード例 #3
0
        public async Task SaveAsync(CashoutsBatchAggregate aggregate)
        {
            var entity = CashoutsBatchEntity.FromDomain(aggregate);

            await _storage.ReplaceAsync(entity);
        }