public IEnumerable <IRow> Run(Process process) { if (!process.Enabled) { _context.Error("Process is disabled"); return(Enumerable.Empty <IRow>()); } foreach (var warning in process.Warnings()) { _context.Warn(warning); } if (process.Errors().Any()) { foreach (var error in process.Errors()) { _context.Error(error); } _context.Error("The configuration errors must be fixed before this job will run."); return(Enumerable.Empty <IRow>()); } using (var scope = DefaultContainer.Create(process, _context.Logger)) { var controller = scope.Resolve <IProcessController>(); controller.Execute(); return(process.Entities.First().Rows); } }
public void Execute(Process process) { foreach (var warning in process.Warnings()) { _context.Warn(warning); } if (process.Errors().Any()) { foreach (var error in process.Errors()) { _context.Error(error); } _context.Error("The configuration errors must be fixed before this job will run."); return; } using (var scope = DefaultContainer.Create(process, _context.Logger)) { try { scope.Resolve <IProcessController>().Execute(); } catch (Exception ex) { _context.Error(ex.Message); } } }
public ActionResponse Execute() { var response = new ActionResponse(); if (!Process.Enabled) return response; using (var scope = DefaultContainer.Create(Process, _context.Logger)) { scope.Resolve<IProcessController>().Execute(); } return response; }
public ActionResponse Execute() { var process = _context.Process; var originalOutput = process.Connections.First(c => c.Name == Constants.OriginalOutput); process.Connections.Remove(originalOutput); originalOutput.Name = "output"; var threshold = process.Entities.Min(e => e.BatchId) - 1; var readFirstTable = process.InternalProvider == "sqlce" && process.Entities.Count == 1; var firstEntity = process.Entities.First(); var firstTable = firstEntity.OutputTableName(process.Name); var counter = (short)0; var reversed = new Process { Name = process.Name, ReadOnly = true, Connections = new List <Connection>(2) { new Connection { Name = "input", Provider = process.InternalProvider, File = process.Output().File }, originalOutput }, Entities = new List <Entity>(1) { new Entity { Name = process.InternalProvider == "sqlce" ? (readFirstTable ? firstTable : process.Flat) : process.Star, Connection = "input", Fields = process.GetStarFields().SelectMany(f => f).Select(field => new Field { Index = counter++, MasterIndex = field.Index, Name = readFirstTable ? field.FieldName() : field.Alias, Alias = field.Alias, Type = field.Type, Input = true, PrimaryKey = field.Name == Constants.TflKey }).ToList(), Filter = new List <Filter> { new Filter { Field = readFirstTable ? firstEntity.TflBatchId().FieldName() : Constants.TflBatchId, Operator = "greaterthan", Value = threshold.ToString() } } } } }; reversed.Check(); if (reversed.Errors().Any()) { foreach (var error in reversed.Errors()) { _context.Error(error); } return(new ActionResponse(500, "See error log")); } using (var scope = DefaultContainer.Create(reversed, _context.Logger, "@[]")) { scope.Resolve <IProcessController>().Execute(); if (originalOutput.Provider == "internal") { process.Rows = reversed.Entities.First().Rows; } } return(new ActionResponse(200, string.Empty)); }