public void AddItem(WorkflowItem item) { if (!string.IsNullOrWhiteSpace(item.Name)) { workflowList.Add(item); } else { throw new ArgumentException("Workflow item has no name"); } if (!CheckSoundness()) { throw new Exception("Workflow is not sound."); } }
private bool CheckSoundness(List <WorkflowItem> workList = null) { if (workList == null) { workList = workflowList; } WorkflowItem lastItem = null; var sound = true; foreach (var item in workList) { if (lastItem == null) { lastItem = item; continue; } var lt = lastItem.GetOutputType(); var it = item.GetInputType(); sound = sound && (lt == it); lastItem = item; } return(sound); }