I came across this post from Mark Seemann "Service Locator 2 Released". This post caught my attention as it was a while ago that I thought of it. The "service locator" mainly reminds me to the period I was still working as a consultant. Being a technical architect at that time I was deep into the J2EE patterns like the service locator.
Martin Fowler has an excellent read on Inversion of Control Containers and the Dependency Injection pattern, and how it contrast with the Service Locator alternative.
But back to the Service Locator 2. What is it and why would you use it?
Service Locator is an application block which integrates with Enterprise Library. It's a general-purpose, provider-driven abstract factory, which can be used to create instances of component servers, following the Service Locator design pattern. It supports configurable as well as run-time dependency injection.
If you're using any of the application blocks and the Enterprise Library than this is something for you. The 2.0 release of the Service Locator for Enterprise Library is a complete rewrite, targeting Microsoft patterns & practices Enterprise Library for .NET Framework 2.0 - January 2006. The platform is .NET 2.0. The project files targets Visual Studio 2005.
The highlights of this release include:
Download the bits here from CodePlex and participate in this open source project.