“This project adds the second leg to the service story by complementing Service Location with Service Configuration.”

This is is a derivation of the great work done by a big number of prominent .NET world developers in the Common Service Locator (CSL) project.

The goal of that project is to provide a lowest common denominator for locating services that was still useful to the different Inversion of Control (IoC) Containers on the market today. The common interface that resulted from this work resulted in a way to locate services common for all of the containers that support the project. That’s really awesome! The CSL specifically does not include anything about configuring a container or registering types. The argument is that this configuration is where the various containers differ the most and offer the most individual value. It is expected that anyone using this library will have a bootstrapper method of some sort that sets up the initial container using whatever concrete container they choose.

This is all very good indeed. The line of reasoning is solid. This project respectfully begs to differ slightly in the last respect.

Rationale for THIS project ;~)

  • First (and most importantly): The tasks that you want to perform as a developer configuring the usage of an IoC container are few and mostly the same. Thus a common configuration API is actually a good idea.
  • Second: If you separate yourself in your code from the reference to a specific IoC container and still want to use that containers API to configure your container you will get that reference back.
  • Third: Even if one API with a set of perceived “common” methods is good it is likely to come up a request or two that is not covered by the 95% of the cases that this API does cover. This API may be easily be extended with container specific configuration options. The gain of using this extended API is lessened since there is now a logical tie to a specific feature set of a particular container. The most important gain is still present; that of abstracting away a specific implementation (any implmentation) of an IoC Conatiner from your code.

Please note: The CSM is not a Silver Bullet either. ;~) Having that said coming 95% of the way to the goal is pretty nice!

Again:

“This project adds the second leg to the service story by complementing Service Location with Service Configuration.”

 

For more rationale and answers to common questions regarding service location and service configuration see; Q & A

Authors Note: We have used this code very much to our benefit in several projects and we felt it was about time to share it. HTH!

Last edited Sep 5, 2010 at 7:51 PM by NoopMan, version 9

Comments

No comments yet.