public Dictionary <string, ITransformation> Build(int pipeNumber) { var pipe = new Dictionary <string, ITransformation>(); int count = 0; foreach (var tranConfig in _transactionElements) { count++; var tranName = tranConfig.Attribute("name")?.Value; if (string.IsNullOrWhiteSpace(tranName)) { throw new TransformationPipeException(string.Format("Incorrect Transformation Config : Missing Name : {0}", tranConfig)); } string tranVersion = tranConfig.Attribute("version")?.Value ?? ""; try { var _transformationFactory = new MefFactory <ITransformation>(); _container.ComposeParts(_transformationFactory); var tran = _transformationFactory.CreateComponent(tranName, tranVersion); tran.Initialise(tranConfig, _globalData, _logger, pipeNumber); pipe.Add(string.Format("{0} - {1}", tranName, count), tran); if (pipeNumber > 1) { _logger.Debug(string.Format("Pipe {0}: Transformation {1} = {2}", pipeNumber, count, tranName)); } else { _logger.Info(string.Format("Pipe {0}: Transformation {1} = {2}", pipeNumber, count, tranName)); } } catch (Exception ex) { _logger.Fatal(string.Format("Pipe {0}: Unable to Create Transformation {1} : {2} ({3})", pipeNumber, count, tranName, ex.Message)); throw new TransformationPipeException(string.Format("Unable to Create Transformation {0} : {1}", tranName, ex.Message)); } } return(pipe); }
private IProcessStep GetProcessStep(int count, XElement processStepConfig) { var processStepName = processStepConfig.Attribute("name")?.Value; if (string.IsNullOrWhiteSpace(processStepName)) { throw new LoadProcessException(string.Format("Incorrect Process Step Config : Missing Name : {0}", processStepName)); } string processStepVersion = processStepConfig.Attribute("version")?.Value ?? ""; try { var processStepFactory = new MefFactory <IProcessStep>(); _container.ComposeParts(processStepFactory); return(processStepFactory.CreateComponent(processStepName, processStepVersion)); } catch (Exception ex) { _logger.Fatal(string.Format("Unable to Create Process Step {0} : {1} ({2})", count, processStepName, ex.Message)); throw new LoadProcessException(string.Format("Unable to Create Process Step {0} : {1}", processStepName, ex.Message)); } }