public async Task Handle(CaseElementTransitionRaisedEvent message, CancellationToken token) { var record = await _casePlanInstanceQueryRepository.Get(message.AggregateId, token); record.Handle(message); await _casePlanInstanceCommandRepository.Update(record, token); await _casePlanInstanceCommandRepository.SaveChanges(token); }
public async Task <CasePlanInstanceResult> Handle(GetCasePlanInstanceQuery request, CancellationToken cancellationToken) { var result = await _casePlanInstanceQueryRepository.Get(request.CasePlanInstanceId, cancellationToken); if (result == null) { throw new UnknownCasePlanInstanceException(request.CasePlanInstanceId); } return(CasePlanInstanceResult.ToDto(result)); }
public async Task <CasePlanInstanceAggregate> MonitorCasePlanInstance(string id, Func <CasePlanInstanceAggregate, bool> callback, CancellationToken token) { while (true) { Thread.Sleep(100); var result = await _casePlanInstanceQueryRepository.Get(id, token); if (callback(result)) { return(result); } } }