October 9, 2012

Create your own pipeline

As you know sitecore use a lot of pipeline but did you already try to create your own pipeline for your custom actions?
To create your own pipeline in sitecore it is easy, you will need to:
  • Add your pipeline and porocessors in the web.config (or externalize it in the \app_config\include folder)
    <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
            <processor type="MyNamespace.MyProcessor, MyDll" />          
  • After you may call it with this code and t will wall all the processors in this pipeline:
    PipelineArgs args = new PipelineArgs();
    CorePipeline.Run("myCustomPipeline", args);
Simple doesn’t it? You may also use your own argument if you need to pass some additional properties to the processors. To do that, you just need to create a new class who inherit from PipelineArgs.