private void Handle(ProcessInstanceCreatedEvent evt)
 {
     AggregateId     = evt.AggregateId;
     Version         = evt.Version;
     ProcessFileId   = evt.ProcessFileId;
     ProcessFileName = evt.ProcessFileName;
     CreateDateTime  = evt.CreateDateTime;
     Status          = ProcessInstanceStatus.CREATED;
     Interfaces      = evt.Interfaces;
     Messages        = evt.Messages;
     ItemDefs        = evt.ItemDefs;
     SequenceFlows   = evt.SequenceFlows;
 }
 private void Handle(ProcessInstanceCreatedEvent evt)
 {
     AggregateId     = evt.AggregateId;
     Version         = evt.Version;
     ProcessFileId   = evt.ProcessFileId;
     ProcessFileName = evt.ProcessFileName;
     CreateDateTime  = evt.CreateDateTime;
     Status          = ProcessInstanceStatus.CREATED;
     Interfaces      = new ConcurrentBag <BPMNInterface>(evt.Interfaces);
     Messages        = new ConcurrentBag <Message>(evt.Messages);
     ItemDefs        = new ConcurrentBag <ItemDefinition>(evt.ItemDefs);
     SequenceFlows   = new ConcurrentBag <SequenceFlow>(evt.SequenceFlows);
 }
        public static ProcessInstanceAggregate New(string processFileId, string processFileName, ICollection <BaseFlowNode> elements, ICollection <BPMNInterface> interfaces, ICollection <Message> messages, ICollection <ItemDefinition> itemDefs, ICollection <SequenceFlow> sequenceFlows)
        {
            var result = new ProcessInstanceAggregate();
            var evt    = new ProcessInstanceCreatedEvent(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), 0, processFileId, processFileName, interfaces, messages, itemDefs, sequenceFlows, DateTime.UtcNow);

            result.Handle(evt);
            result.DomainEvents.Add(evt);
            foreach (var elt in elements)
            {
                result.AddFlowNodeDef(elt);
            }

            return(result);
        }