<p>I absolutely need to use an IoC container for decoupling dependencies in an ever increasingly complex system of enterprise services.  The issue I am facing is one related to configuration (a.k.a. registration).  We currently have 4 different environments -- development to production and in between.  These environments have numerous configurations that slightly vary from environment to environment; however, in all cases that <em>I can currently think of</em>, dependencies between components do not differ from environment to environment, though I could have missed something and/or this could obviously change.  </p>

<p>So, the ultimate question is, does anybody have a similar experience using an IoC framework?  Or, can anybody recommend one framework over another that would provide flexible registration be it through some sort of convention or simplified configuration information?  Would I still be able to benefit from a fluent interface or am I stuck with XML -- I'd like to avoid XML-hell.</p>

<p><strong>Edit:</strong> This is a .Net environment and I have been looking at Windsor, Ninject and Autofac.  They all seem to now support both methods of registration (fluent and XML), though Autofac's support for lambda expressions seems to be a little different than the others.  Anybody use that in a similar multi-deployment environment?</p>

[{'answer_id': 45224, 'author': 'Glenn Slaven', 'author_id': 2975, 'author_profile': 'https://Stackoverflow.com/users/2975', 'pm_score': 1, 'selected': False, 'text': '<p>I\'m not sure whether it will suit your particular case, you didn\'t mention what platform you\'re working in, but I\'ve had great success with <a href="http://www.castleproject.org/container/index.html" rel="nofollow noreferrer">Castle Windsor\'s IOC framework</a>. The dependencies are setup in the config file (it\'s a .NET framework)</p>\n'}, {'answer_id': 45606, 'author': 'chrissie1', 'author_id': 2936, 'author_profile': 'https://Stackoverflow.com/users/2936', 'pm_score': 1, 'selected': False, 'text': "<p>Look at Ayendes rhino commons. He uses an abstraction over the IoC container. So that you can switch containers whenever you want. Something like container.Resolve is always there in every container.</p>\n\n<p>I use Structuremap to do the dirty work it has a fluent interface and the XML things and it is powerfull enough for most things you want to do. Each one has it's own pros and cons so a little abstraction so you can easily switch (you never know how long they are going to be around) is good. For the rest I think Spring.Net, Castle windsor, Ninject and StructureMap  aren't that far apart anymore.</p>\n"}, {'answer_id': 45699, 'author': 'Dale Ragan', 'author_id': 1117, 'author_profile': 'https://Stackoverflow.com/users/1117', 'pm_score': 3, 'selected': True, 'text': '<p>I use <a href="http://www.ninject.org/" rel="nofollow noreferrer">Ninject</a>.  I like the fact that I don\'t have to use Xml to configure the dependencies.  I can just use straight up C# code.  There are <a href="http://kohari.org/2008/06/08/attributes-we-dont-need-no-stinkin-attributes/" rel="nofollow noreferrer">multiple ways</a> of doing it also.  I know other libraries have that feature, but Ninject offers fast instantiation, it is pretty lightweight, it has conditional binding, supports compact framework, and it supports Silverlight, 2.0.  I also use a wrapper on top of it, in case I do switch it out for another framework in the future.  You should definitely try Ninject when deciding on a framework.</p>\n'}, {'answer_id': 527183, 'author': 'Sean Feldman', 'author_id': 59563, 'author_profile': 'https://Stackoverflow.com/users/59563', 'pm_score': 2, 'selected': False, 'text': '<p>If you want to abstract your container, and be able to use different ones, look into having it injectable in a way I tried to do it <a href="http://weblogs.asp.net/sfeldman/archive/2009/02/08/switching-ioc-container-with-linq-expressions.aspx" rel="nofollow noreferrer" title="here">here</a></p>\n'}]
['https://Stackoverflow.com/questions/45202', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1875/']