“From a certain point of view.” Context is everything in Sitecore

I’ve written a lot of code that has appeared in “libraries” or “best practices” or “secret ingredients” for a number of Sitecore shops in the last dozen years. Today’s library highlight stands out in that I’ve never seen anything close to it in the wild, and frankly, I believe this should be the way Sitecore behaves by default. 

Constellation.Foundation.Contexts is all about preventing pipeline problems by making sure the scenario you’re  programming against is actually the scenario being executed. I’m talking about Pipeline Processors, and the fact that they cause so many headaches because developers often forget that Sitecore’s interfaces use the same pipeline you just customized!

This library allows you to responsibly wrap your pipeline processor in a decision maker that will determine if your processor should execute. The decision is based upon the current Sitecore context:

  • Hostname
  • Site
  • Database
  • Path

With Constellation you can use the Sitecore configuration files to white list or black list any of the above parameters for your pipeline processor, ensuring that it only executes under the conditions you’re expecting. You can also have it perform an activity when it defers processing because the context is not right.

I recently had a peer comment that they thought this configuration was “stock Sitecore”! If you only borrow one thing from the Constellation library, it should probably be Foundation.Contexts.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.