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();
        }
Esempio n. 2
0
        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)
            {
            }
        }
Esempio n. 3
0
        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 void Register(string pipelineStep, Type behavior, string description)
 {
     additions.Add(RegisterStep.Create(pipelineStep, behavior, description));
 }