Пример #1
0
        public async Task Update(User.Aggregate aggregate)
        {
            var dto = new Dtos.User();

            dto.Populate(aggregate.State);

            await database.UpdateAsync(dto);
        }
Пример #2
0
        public async Task <User.Aggregate> Insert(User.Aggregate aggregate)
        {
            var dto = new Dtos.User();

            dto.Populate(aggregate.State);
            dto.Id = (long)await database.InsertAsync(dto);

            var state = dto.Map();

            state.HasNewIdentity = true;

            return(new User.Aggregate(state));
        }
Пример #3
0
            protected async override Task Handle(Request request, CancellationToken cancellationToken)
            {
                var user = new User.Aggregate("Bob Smith");

                user = await this.userRepository.Insert(user);

                var fetched = await this.userRepository.Fetch(user.State.Id);

                fetched.ChangeName("Fred Bloggs");

                await this.userRepository.Update(fetched);

                await this.userRepository.Delete(fetched);
            }