public async Task Update(User.Aggregate aggregate) { var dto = new Dtos.User(); dto.Populate(aggregate.State); await database.UpdateAsync(dto); }
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)); }
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); }