public void SetUp() { behaviorContext = new BehaviorContext(); pipelineModificationsBeforeOptimizations = new PipelineModifications(); for (int i = 0; i < PipelineDepth; i++) { pipelineModificationsBeforeOptimizations.Additions.Add(RegisterStep.Create(i.ToString(), typeof(Behavior1AfterOptimization), i.ToString(), b => new Behavior1AfterOptimization())); } pipelineModificationsAfterOptimizations = new PipelineModifications(); for (int i = 0; i < PipelineDepth; i++) { pipelineModificationsAfterOptimizations.Additions.Add(RegisterStep.Create(i.ToString(), typeof(Behavior1SealedOptimization), i.ToString(), b => new Behavior1SealedOptimization())); } pipelineBeforeOptimizations = new PipelineAfterOptimizationsUnsafe <IBehaviorContext>(null, new SettingsHolder(), pipelineModificationsBeforeOptimizations); pipelineAfterOptimizations = new PipelineAfterOptimizationsUnsafe <IBehaviorContext>(null, new SettingsHolder(), pipelineModificationsAfterOptimizations); // warmup and cache pipelineBeforeOptimizations.Invoke(behaviorContext).GetAwaiter().GetResult(); pipelineAfterOptimizations.Invoke(behaviorContext).GetAwaiter().GetResult(); }
public void SetUp() { behaviorContext = new BehaviorContext(); pipelineModificationsBeforeOptimizations = new PipelineModifications(); for (int i = 0; i < PipelineDepth; i++) { pipelineModificationsBeforeOptimizations.Additions.Add(RegisterStep.Create(i.ToString(), typeof(Behavior1BeforeOptimization), i.ToString(), b => new Behavior1BeforeOptimization())); } var stepdId = PipelineDepth + 1; pipelineModificationsBeforeOptimizations.Additions.Add(RegisterStep.Create(stepdId.ToString(), typeof(Throwing), "1", b => new Throwing())); pipelineModificationsAfterOptimizations = new PipelineModifications(); for (int i = 0; i < PipelineDepth; i++) { pipelineModificationsAfterOptimizations.Additions.Add(RegisterStep.Create(i.ToString(), typeof(Behavior1AfterOptimization), i.ToString(), b => new Behavior1AfterOptimization())); } pipelineModificationsAfterOptimizations.Additions.Add(RegisterStep.Create(stepdId.ToString(), typeof(Throwing), "1", b => new Throwing())); pipelineModificationsAfterOptimizationsFastExpressionCompiler = new PipelineModifications(); for (int i = 0; i < PipelineDepth; i++) { pipelineModificationsAfterOptimizationsFastExpressionCompiler.Additions.Add(RegisterStep.Create(i.ToString(), typeof(Behavior1AfterOptimization), i.ToString(), b => new Behavior1AfterOptimization())); } pipelineModificationsAfterOptimizationsFastExpressionCompiler.Additions.Add(RegisterStep.Create(stepdId.ToString(), typeof(Throwing), "1", b => new Throwing())); pipelineBeforeOptimizations = new PipelineBeforeOptimization <IBehaviorContext>(null, new SettingsHolder(), pipelineModificationsBeforeOptimizations); pipelineAfterOptimizations = new PipelineAfterOptimizations <IBehaviorContext>(null, new SettingsHolder(), pipelineModificationsAfterOptimizations); pipelineAfterOptimizationsFastExpressionCompiler = new PipelineFastExpressionCompiler <IBehaviorContext>(null, new SettingsHolder(), pipelineModificationsAfterOptimizationsFastExpressionCompiler); // warmup and cache try { pipelineBeforeOptimizations.Invoke(behaviorContext).GetAwaiter().GetResult(); } catch (Exception) { } try { pipelineAfterOptimizations.Invoke(behaviorContext).GetAwaiter().GetResult(); } catch (Exception) { } try { pipelineAfterOptimizationsFastExpressionCompiler.Invoke(behaviorContext).GetAwaiter().GetResult(); } catch (Exception) { } }
public PipelineBeforeOptimization(IBuilder builder, ReadOnlySettings settings, PipelineModifications pipelineModifications) { var coordinator = new StepRegistrationsCoordinator(pipelineModifications.Removals, pipelineModifications.Replacements); foreach (var rego in pipelineModifications.Additions.Where(x => x.IsEnabled(settings))) { coordinator.Register(rego); } behaviors = coordinator.BuildPipelineModelFor <TContext>() .Select(r => r.CreateBehaviorOld(builder)).ToArray(); }
public void SetUp() { pipelineModificationsBeforeOptimizations = new PipelineModifications(); for (int i = 0; i < PipelineDepth; i++) { pipelineModificationsBeforeOptimizations.Additions.Add(RegisterStep.Create(i.ToString(), typeof(Behavior1BeforeOptimization), i.ToString(), b => new Behavior1BeforeOptimization())); } pipelineModificationsAfterOptimizationsWithUnsafe = new PipelineModifications(); for (int i = 0; i < PipelineDepth; i++) { pipelineModificationsAfterOptimizationsWithUnsafe.Additions.Add(RegisterStep.Create(i.ToString(), typeof(Behavior1AfterOptimization), i.ToString(), b => new Behavior1AfterOptimization())); } }
public PipelineAfterOptimizations(IBuilder builder, ReadOnlySettings settings, PipelineModifications pipelineModifications) { var coordinator = new StepRegistrationsCoordinator(pipelineModifications.Removals, pipelineModifications.Replacements); foreach (var rego in pipelineModifications.Additions.Where(x => x.IsEnabled(settings))) { coordinator.Register(rego); } // Important to keep a reference behaviors = coordinator.BuildPipelineModelFor <TContext>() .Select(r => r.CreateBehaviorNew(builder)).ToArray(); pipeline = behaviors.CreatePipelineExecutionFuncFor <TContext>(); }