public GameLoop( GraphicsDeviceManager graphics, GraphicsDevice device, OpaqueEffect effect, PostProcessTriangle postProcessTriangle, FrameService frameService, MainWindow mainWindow, SceneManager sceneManager, GameWindow window, RenderPipelineBuilder renderPipelineBuilder, GameTimer gameTimer, KeyboardController keyboard, MouseController mouse, CameraController cameraController) { this.Graphics = graphics; this.Device = device; this.Effect = effect; this.PostProcessTriangle = postProcessTriangle; this.FrameService = frameService; this.MainWindow = mainWindow; this.SceneManager = sceneManager; this.Window = window; this.GameTimer = gameTimer; this.Keyboard = keyboard; this.Mouse = mouse; this.CameraController = cameraController; this.RenderPipeline = renderPipelineBuilder.Build(); this.FrameCounter = new FrameCounter(); }
public override void LoadEntity(ContainerBuilder builder, Process process, Entity entity) { if (process == null) { return; } var type = process.Pipeline == "defer" ? entity.Pipeline : process.Pipeline; builder.Register(ctx => { var context = ctx.ResolveNamed <IContext>(entity.Key); IPipeline pipeline; context.Debug(() => $"Registering {type} for entity {entity.Alias}."); var outputController = ctx.IsRegisteredWithName <IOutputController>(entity.Key) ? ctx.ResolveNamed <IOutputController>(entity.Key) : new NullOutputController(); switch (type) { case "parallel.linq": pipeline = new ParallelPipeline(new DefaultPipeline(outputController, context)); break; default: pipeline = new DefaultPipeline(outputController, context); break; } var provider = process.Output().Provider; // TODO: rely on IInputProvider's Read method instead (after every provider has one) pipeline.Register(ctx.IsRegisteredWithName(entity.Key, typeof(IRead)) ? ctx.ResolveNamed <IRead>(entity.Key) : null); pipeline.Register(ctx.IsRegisteredWithName(entity.Key, typeof(IInputProvider)) ? ctx.ResolveNamed <IInputProvider>(entity.Key) : null); // transform if (!process.ReadOnly) { pipeline.Register(new SetSystemFields(new PipelineContext(ctx.Resolve <IPipelineLogger>(), process, entity))); } pipeline.Register(new DefaultTransform(new PipelineContext(ctx.Resolve <IPipelineLogger>(), process, entity), context.GetAllEntityFields().Where(f => !f.System))); pipeline.Register(TransformFactory.GetTransforms(ctx, context, entity.GetAllFields().Where(f => f.Transforms.Any()))); pipeline.Register(ValidateFactory.GetValidators(ctx, context, entity.GetAllFields().Where(f => f.Validators.Any()))); if (!process.ReadOnly) { pipeline.Register(new StringTruncateTransfom(new PipelineContext(ctx.Resolve <IPipelineLogger>(), process, entity))); if (provider == "sqlserver") { pipeline.Register(new MinDateTransform(new PipelineContext(ctx.Resolve <IPipelineLogger>(), process, entity), new DateTime(1753, 1, 1))); } } // writer, TODO: rely on IOutputProvider instead pipeline.Register(ctx.IsRegisteredWithName(entity.Key, typeof(IWrite)) ? ctx.ResolveNamed <IWrite>(entity.Key) : null); pipeline.Register(ctx.IsRegisteredWithName(entity.Key, typeof(IOutputProvider)) ? ctx.ResolveNamed <IOutputProvider>(entity.Key) : null); // updater pipeline.Register(process.ReadOnly || !ctx.IsRegisteredWithName(entity.Key, typeof(IUpdate)) ? new NullUpdater() : ctx.ResolveNamed <IUpdate>(entity.Key)); return(pipeline); }).Named <IPipeline>(entity.Key); }
public void CompleteMultipleFrames() { var pipelineStages = new List <PipelineStage>(); var soloSystem = new SoloSystem(); var methodInfo = soloSystem.GetType().GetMethod("Process"); var systemBindings = new List <ISystemBinding>(); systemBindings.Add(new SystemBindingWithoutComponents(methodInfo, soloSystem)); pipelineStages.Add(new PipelineStage(systemBindings)); pipelineStages.Add(new PipelineStage(systemBindings)); var pipeline = new ParallelPipeline(pipelineStages); pipeline.Run(); pipeline.Wait(); Assert.That(pipeline.ActiveThreads, Is.EqualTo(1)); pipeline.Run(); pipeline.Wait(); Assert.That(pipeline.ActiveThreads, Is.EqualTo(1)); pipeline.Stop(); Assert.That(pipeline.ActiveThreads, Is.EqualTo(0)); }
public override void LoadEntity(ContainerBuilder builder, Process process, Entity entity) { if (process == null) { return; } var type = process.Pipeline == "defer" ? entity.Pipeline : process.Pipeline; builder.Register(ctx => { var context = ctx.ResolveNamed <IContext>(entity.Key); IPipeline pipeline; context.Debug(() => $"Registering {type} for entity {entity.Alias}."); switch (type) { case "parallel.linq": pipeline = new ParallelPipeline(new DefaultPipeline(ctx.ResolveNamed <IOutputController>(entity.Key), context)); break; default: pipeline = new DefaultPipeline(ctx.ResolveNamed <IOutputController>(entity.Key), context); break; } var provider = process.Output().Provider; // extract pipeline.Register(ctx.ResolveNamed <IRead>(entity.Key)); // transform pipeline.Register(new SetBatchId(new PipelineContext(ctx.Resolve <IPipelineLogger>(), process, entity, entity.TflBatchId()))); pipeline.Register(new DefaultTransform(new PipelineContext(ctx.Resolve <IPipelineLogger>(), process, entity), context.GetAllEntityFields())); pipeline.Register(TransformFactory.GetTransforms(ctx, process, entity, entity.GetAllFields().Where(f => f.Transforms.Any()))); pipeline.Register(new SetKey(new PipelineContext(ctx.Resolve <IPipelineLogger>(), process, entity, entity.TflKey()))); pipeline.Register(new StringTruncateTransfom(new PipelineContext(ctx.Resolve <IPipelineLogger>(), process, entity))); if (provider == "sqlserver") { pipeline.Register(new MinDateTransform(new PipelineContext(ctx.Resolve <IPipelineLogger>(), process, entity), new DateTime(1753, 1, 1))); } //load pipeline.Register(ctx.IsRegisteredWithName(entity.Key, typeof(IWrite)) ? ctx.ResolveNamed <IWrite>(entity.Key) : new NullWriter()); pipeline.Register(ctx.IsRegisteredWithName(entity.Key, typeof(IUpdate)) ? ctx.ResolveNamed <IUpdate>(entity.Key) : new NullUpdater()); return(pipeline); }).Named <IPipeline>(entity.Key); }
public override void LoadEntity(ContainerBuilder builder, Process process, Entity entity) { var type = process.Pipeline == "defer" ? entity.Pipeline : process.Pipeline; builder.Register <IPipeline>((ctx) => { var context = new PipelineContext(ctx.Resolve <IPipelineLogger>(), process, entity); IPipeline pipeline; switch (type) { case "parallel.linq": context.Debug("Registering {0} pipeline.", type); pipeline = new ParallelPipeline(new DefaultPipeline(ctx.ResolveNamed <IEntityController>(entity.Key), context)); break; default: context.Debug("Registering linq pipeline.", type); pipeline = new DefaultPipeline(ctx.ResolveNamed <IEntityController>(entity.Key), context); break; } var provider = process.Connections.First(c => c.Name == "output").Provider; // extract pipeline.Register(ctx.ResolveNamed <IRead>(entity.Key)); // transform pipeline.Register(new DefaultTransform(context, context.GetAllEntityFields())); pipeline.Register(new TflHashCodeTransform(context)); pipeline.Register(TransformFactory.GetTransforms(ctx, process, entity, entity.GetAllFields().Where(f => f.Transforms.Any()))); pipeline.Register(new StringTruncateTransfom(context)); if (provider == "sqlserver") { pipeline.Register(new MinDateTransform(context, new DateTime(1753, 1, 1))); } //load pipeline.Register(ctx.ResolveNamed <IWrite>(entity.Key)); pipeline.Register(ctx.ResolveNamed <IUpdate>(entity.Key)); return(pipeline); }).Named <IPipeline>(entity.Key); }
protected override void RegisterProcess(ContainerBuilder builder, Process original) { // I need to create a new process with an entity with the appropriate fields // clone process, remove entities, and create entity needed for calcuted fields var calc = original.Clone() as Process; calc.Entities.Clear(); calc.CalculatedFields.Clear(); calc.Relationships.Clear(); var entity = original.GetDefaultOf <Entity>(e => { e.Name = "sys.Calc"; e.Connection = "output"; e.IsMaster = false; e.Fields = new List <Field> { original.GetDefaultOf <Field>(f => { f.Name = Constants.TflKey; f.Type = "int"; f.PrimaryKey = true; }) }; }); // Add fields that calculated fields depend on entity.Fields.AddRange(original.CalculatedFields .SelectMany(f => f.Transforms) .SelectMany(t => t.Parameters) .Where(p => !p.HasValue() && p.IsField(original)) .Select(p => p.AsField(original).Clone() as Field) ); entity.CalculatedFields.AddRange(original.CalculatedFields.Select(cf => cf.Clone() as Field)); calc.Entities.Add(entity); calc.ModifyKeys(); calc.ModifyIndexes(); // I need a process keyed pipeline builder.Register((ctx) => { var context = new PipelineContext(ctx.Resolve <IPipelineLogger>(), calc, entity); IPipeline pipeline; switch (original.Pipeline) { case "parallel.linq": context.Debug("Registering {0} pipeline.", original.Pipeline); pipeline = new ParallelPipeline(new DefaultPipeline(new NullEntityController(), context)); break; default: context.Debug("Registering linq pipeline.", original.Pipeline); pipeline = new DefaultPipeline(new NullEntityController(), context); break; } // register transforms pipeline.Register(new DefaultTransform(context, entity.CalculatedFields)); pipeline.Register(TransformFactory.GetTransforms(ctx, calc, entity, entity.CalculatedFields)); pipeline.Register(new StringTruncateTransfom(context)); // register input and output var outputContext = new OutputContext(context, new Incrementer(context)); switch (outputContext.Connection.Provider) { case "sqlserver": pipeline.Register(new SqlStarParametersReader(outputContext, original)); pipeline.Register(new SqlCalculatedFieldUpdater(outputContext, original)); pipeline.Register(new MinDateTransform(context, new DateTime(1753, 1, 1))); break; default: pipeline.Register(new NullReader(context)); pipeline.Register(new NullWriter(context)); break; } // no updater necessary pipeline.Register(new NullUpdater(context, false)); return(pipeline); }).Named <IPipeline>(original.Key); }
protected override void Load(ContainerBuilder builder) { if (_process == null) { return; } var calc = _process.ToCalculatedFieldsProcess(); var entity = calc.Entities.First(); // I need a process keyed pipeline builder.Register(ctx => { var context = new PipelineContext(ctx.Resolve <IPipelineLogger>(), calc, entity); var outputContext = new OutputContext(context, new Incrementer(context)); IPipeline pipeline; context.Debug(() => $"Registering {_process.Pipeline} pipeline."); var outputController = ctx.IsRegistered <IOutputController>() ? ctx.Resolve <IOutputController>() : new NullOutputController(); switch (_process.Pipeline) { case "parallel.linq": pipeline = new ParallelPipeline(new DefaultPipeline(outputController, context)); break; default: pipeline = new DefaultPipeline(outputController, context); break; } // no updater necessary pipeline.Register(new NullUpdater(context, false)); if (!_process.CalculatedFields.Any()) { pipeline.Register(new NullReader(context, false)); pipeline.Register(new NullWriter(context, false)); return(pipeline); } // register transforms pipeline.Register(new DefaultTransform(new PipelineContext(ctx.Resolve <IPipelineLogger>(), calc, entity), entity.CalculatedFields)); pipeline.Register(TransformFactory.GetTransforms(ctx, calc, entity, entity.CalculatedFields)); pipeline.Register(new StringTruncateTransfom(new PipelineContext(ctx.Resolve <IPipelineLogger>(), calc, entity))); // register input and output switch (outputContext.Connection.Provider) { case "sqlserver": pipeline.Register(ctx.Resolve <IRead>()); pipeline.Register(ctx.Resolve <IWrite>()); pipeline.Register(new MinDateTransform(new PipelineContext(ctx.Resolve <IPipelineLogger>(), calc, entity), new DateTime(1753, 1, 1))); break; case "mysql": case "postgresql": case "sqlce": case "sqlite": pipeline.Register(ctx.Resolve <IRead>()); pipeline.Register(ctx.Resolve <IWrite>()); break; default: pipeline.Register(new NullReader(context)); pipeline.Register(new NullWriter(context)); break; } return(pipeline); }).As <IPipeline>(); }
public override void LoadEntity(ContainerBuilder builder, Process process, Entity entity) { if (process == null) { return; } var type = process.Pipeline == "defer" ? entity.Pipeline : process.Pipeline; builder.Register(ctx => { var context = ctx.ResolveNamed <IContext>(entity.Key); IPipeline pipeline; context.Debug(() => $"Registering {type} for entity {entity.Alias}."); var outputController = ctx.IsRegisteredWithName <IOutputController>(entity.Key) ? ctx.ResolveNamed <IOutputController>(entity.Key) : new NullOutputController(); switch (type) { case "parallel.linq": pipeline = new ParallelPipeline(new DefaultPipeline(outputController, context)); break; default: pipeline = new DefaultPipeline(outputController, context); break; } var output = process.Output(); // TODO: rely on IInputProvider's Read method instead (after every provider has one) pipeline.Register(ctx.IsRegisteredWithName(entity.Key, typeof(IRead)) ? ctx.ResolveNamed <IRead>(entity.Key) : null); pipeline.Register(ctx.IsRegisteredWithName(entity.Key, typeof(IInputProvider)) ? ctx.ResolveNamed <IInputProvider>(entity.Key) : null); // transforms if (!process.ReadOnly) { pipeline.Register(new SetSystemFields(new PipelineContext(ctx.Resolve <IPipelineLogger>(), process, entity))); } pipeline.Register(new CancelTransform(context)); pipeline.Register(new IncrementTransform(context)); pipeline.Register(new DefaultTransform(context, context.GetAllEntityFields().Where(f => !f.System))); if (ctx.ResolveNamed <IConnectionContext>(entity.Key).Connection.Provider.In("internal", "file", Constants.DefaultSetting)) { foreach (var field in entity.Fields.Where(f => f.Input && f.Type != "string" && (!f.Transforms.Any() || f.Transforms.First().Method != "convert"))) { context.Debug(() => "Automatically adding convert transform"); pipeline.Register(new ConvertTransform(new PipelineContext(context.Logger, context.Process, entity, field, new Operation { Method = "convert" }))); } } pipeline.Register(TransformFactory.GetTransforms(ctx, context, entity.GetAllFields().Where(f => f.Transforms.Any()))); pipeline.Register(ValidateFactory.GetValidators(ctx, context, entity.GetAllFields().Where(f => f.Validators.Any()))); if (!process.ReadOnly) { pipeline.Register(new StringTruncateTransfom(new PipelineContext(ctx.Resolve <IPipelineLogger>(), process, entity))); if (output.Provider == "sqlserver") { pipeline.Register(new MinDateTransform(new PipelineContext(ctx.Resolve <IPipelineLogger>(), process, entity), new DateTime(1753, 1, 1))); } } pipeline.Register(new LogTransform(context)); // writer, TODO: rely on IOutputProvider instead pipeline.Register(ctx.IsRegisteredWithName(entity.Key, typeof(IWrite)) ? ctx.ResolveNamed <IWrite>(entity.Key) : null); pipeline.Register(ctx.IsRegisteredWithName(entity.Key, typeof(IOutputProvider)) ? ctx.ResolveNamed <IOutputProvider>(entity.Key) : null); // updater pipeline.Register(process.ReadOnly || !ctx.IsRegisteredWithName(entity.Key, typeof(IUpdate)) ? new NullUpdater() : ctx.ResolveNamed <IUpdate>(entity.Key)); return(pipeline); }).Named <IPipeline>(entity.Key); }
public ILifetimeScope CreateScope(Process process, IPipelineLogger logger) { var builder = new ContainerBuilder(); #if PLUGINS builder.Properties["Process"] = process; #endif builder.Register(ctx => process).As <Process>(); builder.RegisterInstance(logger).As <IPipelineLogger>().SingleInstance(); // register short-hand for t attribute var transformModule = new TransformModule(process, _methods, _shortHand, logger); foreach (var t in _transforms) { transformModule.AddTransform(t); } builder.RegisterModule(transformModule); // register short-hand for v attribute var validateModule = new ValidateModule(process, _methods, _shortHand, logger); foreach (var v in _validators) { validateModule.AddValidator(v); } builder.RegisterModule(validateModule); #if PLUGINS // just in case other modules need to see these builder.Properties["ShortHand"] = _shortHand; builder.Properties["Methods"] = _methods; #endif foreach (var module in _modules) { builder.RegisterModule(module); } // Process Context builder.Register <IContext>((ctx, p) => new PipelineContext(logger, process)).As <IContext>(); // Process Output Context builder.Register(ctx => { var context = ctx.Resolve <IContext>(); return(new OutputContext(context)); }).As <OutputContext>(); // Connection and Process Level Output Context foreach (var connection in process.Connections) { builder.Register(ctx => new ConnectionContext(ctx.Resolve <IContext>(), connection)).Named <IConnectionContext>(connection.Key); if (connection.Name != "output") { continue; } // register output for connection builder.Register(ctx => { var context = ctx.ResolveNamed <IConnectionContext>(connection.Key); return(new OutputContext(context)); }).Named <OutputContext>(connection.Key); } // Entity Context and RowFactory foreach (var entity in process.Entities) { builder.Register <IContext>((ctx, p) => new PipelineContext(ctx.Resolve <IPipelineLogger>(), process, entity)).Named <IContext>(entity.Key); builder.Register(ctx => { var context = ctx.ResolveNamed <IContext>(entity.Key); return(new InputContext(context)); }).Named <InputContext>(entity.Key); builder.Register <IRowFactory>((ctx, p) => new RowFactory(p.Named <int>("capacity"), entity.IsMaster, false)).Named <IRowFactory>(entity.Key); builder.Register(ctx => { var context = ctx.ResolveNamed <IContext>(entity.Key); return(new OutputContext(context)); }).Named <OutputContext>(entity.Key); var connection = process.Connections.First(c => c.Name == entity.Connection); builder.Register(ctx => new ConnectionContext(ctx.Resolve <IContext>(), connection)).Named <IConnectionContext>(entity.Key); } // internal entity input foreach (var entity in process.Entities.Where(e => process.Connections.First(c => c.Name == e.Connection).Provider == "internal")) { builder.RegisterType <NullInputProvider>().Named <IInputProvider>(entity.Key); // READER builder.Register <IRead>(ctx => { var input = ctx.ResolveNamed <InputContext>(entity.Key); var rowFactory = ctx.ResolveNamed <IRowFactory>(entity.Key, new NamedParameter("capacity", input.RowCapacity)); return(new InternalReader(input, rowFactory)); }).Named <IRead>(entity.Key); } // Internal Entity Output if (process.Output().Provider == "internal") { // PROCESS OUTPUT CONTROLLER builder.Register <IOutputController>(ctx => new NullOutputController()).As <IOutputController>(); foreach (var entity in process.Entities) { builder.Register <IOutputController>(ctx => new NullOutputController()).Named <IOutputController>(entity.Key); builder.Register <IOutputProvider>(ctx => new InternalOutputProvider(ctx.ResolveNamed <OutputContext>(entity.Key), ctx.ResolveNamed <IWrite>(entity.Key))).Named <IOutputProvider>(entity.Key); // WRITER builder.Register <IWrite>(ctx => new InternalWriter(ctx.ResolveNamed <OutputContext>(entity.Key))).Named <IWrite>(entity.Key); } } // entity pipelines foreach (var entity in process.Entities) { builder.Register(ctx => { var type = process.Pipeline == "defer" ? entity.Pipeline : process.Pipeline; var context = ctx.ResolveNamed <IContext>(entity.Key); IPipeline pipeline; context.Debug(() => $"Registering {type} for entity {entity.Alias}."); var outputController = ctx.IsRegisteredWithName <IOutputController>(entity.Key) ? ctx.ResolveNamed <IOutputController>(entity.Key) : new NullOutputController(); switch (type) { case "parallel.linq": pipeline = new ParallelPipeline(new DefaultPipeline(outputController, context)); break; default: pipeline = new DefaultPipeline(outputController, context); break; } // TODO: rely on IInputProvider's Read method instead (after every provider has one) pipeline.Register(ctx.IsRegisteredWithName(entity.Key, typeof(IRead)) ? ctx.ResolveNamed <IRead>(entity.Key) : null); pipeline.Register(ctx.IsRegisteredWithName(entity.Key, typeof(IInputProvider)) ? ctx.ResolveNamed <IInputProvider>(entity.Key) : null); // transforms if (!process.ReadOnly) { pipeline.Register(new SetSystemFields(new PipelineContext(ctx.Resolve <IPipelineLogger>(), process, entity))); } pipeline.Register(new IncrementTransform(context)); pipeline.Register(new DefaultTransform(context, context.GetAllEntityFields().Where(f => !f.System))); pipeline.Register(TransformFactory.GetTransforms(ctx, context, entity.GetAllFields().Where(f => f.Transforms.Any()))); pipeline.Register(ValidateFactory.GetValidators(ctx, context, entity.GetAllFields().Where(f => f.Validators.Any()))); if (!process.ReadOnly) { pipeline.Register(new StringTruncateTransfom(new PipelineContext(ctx.Resolve <IPipelineLogger>(), process, entity))); } pipeline.Register(new Transformalize.Transforms.System.LogTransform(context)); // writer, TODO: rely on IOutputProvider instead pipeline.Register(ctx.IsRegisteredWithName(entity.Key, typeof(IWrite)) ? ctx.ResolveNamed <IWrite>(entity.Key) : null); pipeline.Register(ctx.IsRegisteredWithName(entity.Key, typeof(IOutputProvider)) ? ctx.ResolveNamed <IOutputProvider>(entity.Key) : null); // updater pipeline.Register(process.ReadOnly || !ctx.IsRegisteredWithName(entity.Key, typeof(IUpdate)) ? new NullUpdater() : ctx.ResolveNamed <IUpdate>(entity.Key)); return(pipeline); }).Named <IPipeline>(entity.Key); } // process pipeline builder.Register(ctx => { var calc = process.ToCalculatedFieldsProcess(); var entity = calc.Entities.First(); var context = new PipelineContext(ctx.Resolve <IPipelineLogger>(), calc, entity); var outputContext = new OutputContext(context); IPipeline pipeline; context.Debug(() => $"Registering {process.Pipeline} pipeline."); var outputController = ctx.IsRegistered <IOutputController>() ? ctx.Resolve <IOutputController>() : new NullOutputController(); switch (process.Pipeline) { case "parallel.linq": pipeline = new ParallelPipeline(new DefaultPipeline(outputController, context)); break; default: pipeline = new DefaultPipeline(outputController, context); break; } // no updater necessary pipeline.Register(new NullUpdater(context, false)); if (!process.CalculatedFields.Any()) { pipeline.Register(new NullReader(context, false)); pipeline.Register(new NullWriter(context, false)); return(pipeline); } // register transforms pipeline.Register(new IncrementTransform(context)); pipeline.Register(new Transformalize.Transforms.System.LogTransform(context)); pipeline.Register(new DefaultTransform(new PipelineContext(ctx.Resolve <IPipelineLogger>(), calc, entity), entity.CalculatedFields)); pipeline.Register(TransformFactory.GetTransforms(ctx, context, entity.CalculatedFields)); pipeline.Register(ValidateFactory.GetValidators(ctx, context, entity.GetAllFields().Where(f => f.Validators.Any()))); pipeline.Register(new StringTruncateTransfom(new PipelineContext(ctx.Resolve <IPipelineLogger>(), calc, entity))); // register input and output pipeline.Register(ctx.IsRegistered <IRead>() ? ctx.Resolve <IRead>() : new NullReader(context)); pipeline.Register(ctx.IsRegistered <IWrite>() ? ctx.Resolve <IWrite>() : new NullWriter(context)); if (outputContext.Connection.Provider == "sqlserver") { pipeline.Register(new MinDateTransform(new PipelineContext(ctx.Resolve <IPipelineLogger>(), calc, entity), new DateTime(1753, 1, 1))); } return(pipeline); }).As <IPipeline>(); // process controller builder.Register <IProcessController>(ctx => { var pipelines = new List <IPipeline>(); // entity-level pipelines foreach (var entity in process.Entities) { var pipeline = ctx.ResolveNamed <IPipeline>(entity.Key); pipelines.Add(pipeline); if (entity.Delete && process.Mode != "init") { pipeline.Register(ctx.ResolveNamed <IEntityDeleteHandler>(entity.Key)); } } // process-level pipeline for process level calculated fields if (ctx.IsRegistered <IPipeline>()) { pipelines.Add(ctx.Resolve <IPipeline>()); } var context = ctx.Resolve <IContext>(); var controller = new ProcessController(pipelines, context); // output initialization if (process.Mode == "init" && ctx.IsRegistered <IInitializer>()) { controller.PreActions.Add(ctx.Resolve <IInitializer>()); } // flatten(ing) is first post-action var isAdo = Constants.AdoProviderSet().Contains(process.Output().Provider); if (process.Flatten && isAdo) { if (ctx.IsRegisteredWithName <IAction>(process.Output().Key)) { controller.PostActions.Add(ctx.ResolveNamed <IAction>(process.Output().Key)); } else { context.Error($"Could not find ADO Flatten Action for provider {process.Output().Provider}."); } } // actions foreach (var action in process.Actions.Where(a => a.GetModes().Any(m => m == process.Mode || m == "*"))) { if (action.Before) { controller.PreActions.Add(ctx.ResolveNamed <IAction>(action.Key)); } if (action.After) { controller.PostActions.Add(ctx.ResolveNamed <IAction>(action.Key)); } } return(controller); }).As <IProcessController>(); var build = builder.Build(); return(build.BeginLifetimeScope()); }