Exemple #1
0
        protected virtual void InitializePipeline(PipelineWrapper pipeline)
        {
            pipeline.CorePipeline = CorePipelineFactory.GetPipeline(pipeline.Name, pipeline.Group);

            var processors = ReflectionService.GetProcessors(pipeline.CorePipeline);

            var argTypes = GetAllProcessorArgTypes(pipeline.CorePipeline);

            if (argTypes.Count > 1)
            {
                for (var i = 0; i < argTypes.Count; i++)
                {
                    pipeline.DiscoveryRoots.Add(new DiscoveryItem($"{Constants.ArgsName}[{i}]", argTypes[i]));
                }
            }
            else
            {
                pipeline.DiscoveryRoots.Add(new DiscoveryItem(Constants.ArgsName, argTypes.First()));
            }

            pipeline.DiscoveryRoots.Add(new DiscoveryItem(Constants.ContextName, typeof(Sitecore.Context)));
            foreach (var processor in processors)
            {
                pipeline.Processors.Add(new ProcessorWrapper(processor, pipeline));
            }
            pipeline.Initialized = true;
        }