Oct 23 2008

Common Service Locator

Category: Software DevelopmentJeff @ 06:26

Debates around inversion of control containers (IoC) have a tendency to turn for the worst very quickly.  While there are common goals of loose coupling, improved testability and greater cohesion, often it seems that a lot of effort is spent debating about choices regarding which IoC container to use.  The debates grow especially intense when a framework is created with a dependency on a particular container.

A couple of months ago, Jeremy Miller suggested the creation of a common library so that developers could allow consumers of their frameworks to plug in the IoC container of their choice (It's time for IoC Container Detente).

After a few short weeks, the Common Service Locator project was born.  This project provides a simple adapter and static gateway for registering the IoC container of your choice into a framework that leverages the Common Service Locator.  I created a StructureMap Adapter for this project that you can download on CodePlex.  For simple, in-house applications over which you have complete control, there may not be a need for such an adaptation.  But there are times when swapping out different container implementations is useful, so it's nice to know that it's there when you need it.

Tags: ,

Comments are closed