Common Service Locator Library
Yesterday Glenn Block introduced
a Common Service Locator library
which is described as “a shared
interface that applications and
frameworks can reference in
order to leverage
IoC containers / service location
mechanisms without taking
The idea for the library is based
on a post that Jeremy Miller
wrote of having a shared interface
across several IoC implementation.
The benefit of such an interface is
obvious – no dependency on a
particular IoC implementation.
The result was the birth of a new library – the common service locator library.
The Common Service Locator Library
The library currently holds the IServiceLocator interface which describe the
That contract was agreed by the following IoC containers frameworks creators:
Unity, Spring.Net, Castle Windsor, Structure Map and Ninject.
Other parts of the library include a static ServiceLocator class which
exposes the current container, a ServiceLocatorImplBase which is an abstract class
for building your own service locator and a ServiceLocatorProvider which is the
method to get the current container by the ServiceLocator static class.
The new library suppose to solve the problem of hard dependencies on
IoC containers / service location mechanisms. The library’s birth can demonstrate
the power of the community which see the need and create a library that is agreed
upon. I join the hope of Glenn Block that the new library will encourage products
and frameworks to start leveraging IoC / Service location frameworks.
Download the Common Service Locator library here.
I downloaded it yesterday…