private string TryAddExecutionPointer(string pathId, BaseFlowNode flowNode, ICollection <MessageToken> outcomeValues = null) { ICollection <MessageToken> incoming = new List <MessageToken>(); if (outcomeValues != null) { incoming = outcomeValues; } var instanceId = string.Empty; if (!TryAddInstance(flowNode, pathId, out instanceId)) { var pointer = GetActiveExecutionPointer(pathId, instanceId); if (pointer != null) { var e = new IncomingTokenAddedEvent(Guid.NewGuid().ToString(), AggregateId, Version + 1, pointer.ExecutionPathId, pointer.Id, JsonConvert.SerializeObject(incoming), DateTime.UtcNow); Handle(e); DomainEvents.Add(e); return(pointer.Id); } } var id = Guid.NewGuid().ToString(); var evt = new ExecutionPointerAddedEvent(Guid.NewGuid().ToString(), AggregateId, Version + 1, id, pathId, instanceId, flowNode.EltId, JsonConvert.SerializeObject(incoming), DateTime.UtcNow); Handle(evt); DomainEvents.Add(evt); return(id); }
private void Handle(ExecutionPointerAddedEvent evt) { var tokens = MessageToken.DeserializeLst(evt.SerializedTokens); var path = GetExecutionPath(evt.ExecutionPathId); path.Pointers.Add(new ExecutionPointer { Id = evt.ExecutionPointerId, ExecutionPathId = path.Id, FlowNodeId = evt.FlowNodeId, InstanceFlowNodeId = evt.FlowNodeInstanceId, Incoming = tokens }); Version = evt.Version; UpdateDateTime = evt.CreateDateTime; }