private IFlow LoadFlow(XmlFlow xmlFlow) { string flowId = xmlFlow.Id; if (_flowMap.ContainsKey(flowId)) { return(_flowMap[flowId]); } FlowBuilder <IFlow> flowBuilder = new FlowBuilder <IFlow>(flowId); XmlJobElement firstElement = xmlFlow.JobElements.First(); if (firstElement is XmlStep) { flowBuilder.Start(_stepsMap[firstElement.Id]); } else { XmlFlow xmlSubFlow = firstElement as XmlFlow; XmlSplit xmlSplit = firstElement as XmlSplit; flowBuilder.Start(xmlSubFlow != null ? LoadFlow((XmlFlow)firstElement) : LoadSplit(xmlSplit)); } HandleSubElements(flowBuilder, xmlFlow); IFlow flow = flowBuilder.End(); _flowMap[xmlFlow.Id] = flow; return(flow); }
private IFlow LoadSplit(XmlSplit xmlSplit) { string splitId = xmlSplit.Id; if (_splitMap.ContainsKey(splitId)) { return(_splitMap[splitId]); } // Using the first element as argument in Start method // And all the others (using Skip(1)) in .Add() method FlowBuilder <IFlow> flowBuilder = new FlowBuilder <IFlow>(splitId) .Start(LoadFlow(xmlSplit.Flows.First())) .Split(_executor) .Add(xmlSplit.Flows.Skip(1).Select(LoadFlow).ToArray()); IFlow flow = flowBuilder.End(); _splitMap[xmlSplit.Id] = flow; return(flow); }