title: Windsor Component registration based on common interface
body: <p>I'm trying to register several types that share the same interface <code>ISetting</code> with Windsor container.</p>
  
  <p><strong>Clarification</strong>: <code>ISetting</code> interface doesn't require any implementation. It's only purpose is to help locate setting types within the assembly. Otherwise these setting types are not related to each other in any way, shape or form.</p>
  
  <p>Normally I would create these types one-by-one with code along these lines:</p>
  
  <pre><code>var settingsManager = new SettingsManager();
  var applicationSettings = settingsManager.LoadSettings&lt;ApplicationSettings&gt;();
  var emailSettings = settingsManager.LoadSettings&lt;EmailSettings&gt;();
  </code></pre>
  
  <p>But I would like to register these components by convention, so I don't have to do it manually.</p>
  
  <p>So far I have following code in one of WindsorInstallers:</p>
  
  <pre><code>    container.Register( Classes.FromAssemblyContaining&lt;ISetting&gt;()
                                     .BasedOn&lt;ISetting&gt;()
                                     ...help...
                                     );
  </code></pre>
  
  <p><strong>Clarification</strong>: Setting will be used within the class as concrete type (see below)</p>
  
  <pre><code>public class Service2
  {
      private readonly EmailSettings _settings;
  
      public Service2(EmailSettings settings)
      {
          _settings = settings;
      }
  
      public void Awesome()
      {
          Console.WriteLine(_settings.Value);
      }
  }
  </code></pre>
  
  <p><strong>My Goal</strong>: Even though I could inject all setting types into container one-by-one, I'm looking for a solution where I could locate and register all types inheriting from <code>ISetting</code> using one (maybe two) statements.</p>