Skip to content

PipelineContributors

simonthorogood edited this page Dec 13, 2010 · 7 revisions

Pipeline contributors contain code that execute on every request. Pipeline Contributors have access to the whole context of the current call, can execute before or after any of the built in contributors (also known as well-known contributors) and can halt execution, handle redirections, or render something totally different.

All IPipelineContributors must implement Initialize(IPipeline). It is the responsibility of Initialize to state ’’’what’’’ will execute and ’’’when’’’ in the pipeline the contributor will execute relative to another contributor. Use the KnownStages class to select the relative contributor, e.g.

  public void Initialize(IPipeline pipelineRunner)
  {
      pipelineRunner.Notify(MyMethod).Before<KnownStages.IOperationInvocation>();
  }

Methods called in such a way are of type Func<ICommunicationContext, PipelineContinuation>, and so must return a PipelineContinuation value.

Contributor Lifetimes

Pipeline contributors are instantiated by OpenRasta as singletons. They must therefore be written in a stateless and re-usable manner. Persist instance data in a pipeline contributor at your peril!

See Also

Clone this wiki locally