Sitecore pipelines & commands using IoC containers

Ever wondered how to resolve your command / pipeline entry from your IoC container? One of the more common arguments I have seen for the Service Locator (anti) pattern is for exactly this reason, and it’s completely avoidable. This approach works perfectly well with the likes of Castle Windsor, Autofac, Unity or even Agnostic IoC. This also provides the added bonus of being able to unit test your pipelines, which in my humble opinion is possibly where it is needed most. It also allows you to utilise constructor injection in Sitecore Pipelines (which I have heard from seasoned Sitecore developers can’t be done 😉 ).

In this post I describe how to give control of your dependencies on pipeline & commands to your IoC container of choice using Sitecore factories.
Continue reading