Beispiel #1
0
        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.");
            }
        }
Beispiel #2
0
        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);
        }