Print

Removing Keyed Registrations from the Simple Service Locator

In this post I again like to consult my Simple Service Locator users, readers of my blog, and followers of the Simple Service Locator CodePlex project, about a change to the library I'm considering.

Thanks for everybody who replied to my last blog post about the Simple Service Locator. Because of all the reactions, I'm currently seriously considering to loose the hard dependency on the Common Service Locator. I’m currently trying to come up with a solution where I can have a soft dependency on de Common Service Locator (by loading the assembly with Assembly.Load and using lightweight code generation to generate a IServiceLocator implementation), but this currently seems very fragile.

An other thing I'm currently considering is removing the possibility to do keyed registrations (registering instances by a string key). The reason is the same as with removing the hard dependency on the Common Service Locator: I think it makes little sense when doing dependency injection.

Before making such a change I again want to consult my users and followers. So can you tell me if you are using keyed registrations today in your projects (with the Simple Service Locator or any DI framework for that matter) and have any reason to believe that you can't easily change it to using factories.

Please drop a note in the comments below or send me a mail (to steven at this domain) if you prefer that.

Thanks.

- .NET General, Simple Service Locator - two comments / No trackbacks - §

The code samples on my weblog are colorized using javascript, but you disabled javascript (for my website) on your browser. If you're interested in viewing the posted code snippets in color, please enable javascript.

two comments:

While I am not a user of Simple Service Locator and have no preferences regarding it's usage of the CSL (oddly enough, even though it was my conference session that inspired its creation, I have never used the CSL) I can say that all of my production usage of IoC containers (primarily StructureMap) has involved some amount of named/keyed registrations. Switching out to hand-maintained factories would certainly be easy, but why do the extra work and add the extra chance of making a mistake in said extra work when the container (together with my auto-registration conventions) can do that work for me?
Jeremy Gray - 13 03 11 - 17:04

Here's the conference Jeremy is talking about: http://codebetter.com/jeremymiller/2008/..
Steven (URL) - 11 04 11 - 12:51


No trackbacks:

Trackback link:

Please enable javascript to generate a trackback url


  
Remember personal info?

/

Before sending a comment, you have to answer correctly a simple question everyone knows the answer to. This completely baffles automated spam bots.
 

  (Register your username / Log in)

Notify:
Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.