title: Structuremap configuration for choosing particular type by varying different constructor type
body: <p>I am trying to choose different logger for different type of services. In my following class scenario, i want to use DbAppender for a service which need to log to db and FileAppender for a service which need to log to file.</p>
  
  <p>Here is the class design i have:</p>
  
  <pre><code>public interface ILogger
  {
  
  }
  public class Logger : ILogger
  {
      private readonly IAppender _appender;
  
      public Logger(IAppender appender)
      {
          _appender = appender;
      }
  }
  public interface IAppender
  {
  
  }
  
  public interface IRepository
  {
  
  }
  public class DbAppender : IAppender
  {
      private IRepository _repository;
  
      public DbAppender(IRepository repository)
      {
          _repository = repository;
      }
  }
  
  public class FileAppender : IAppender
  {
  
  }
  
  public interface IHelloDbService
  {
  
  }
  public class HelloServiceWithDbLog : IHelloDbService
  {
      private readonly ILogger _logger;
      public HelloServiceWithDbLog(ILogger logger)
      {
          _logger = logger;
      }
  }
  
  public interface IHelloFileService
  {
  
  }
  public class HelloServiceWithFileLog : IHelloFileService
  {
      private readonly ILogger _logger;
      public HelloServiceWithFileLog(ILogger logger)
      {
          _logger = logger;
      }
  }
  </code></pre>
  
  <p>Now i have to configure structureMap dependency injection accordingly so that for DbService it has to choose logger with db capability and for FileService, it has to choose logger with file capability.</p>
  
  <pre><code>    // this has to configure to choose Logger with FileAppender.
      x.For&lt;IHelloFileService&gt;().Use&lt;HelloServiceWithFileLog&gt;();
                  .Ctor&lt;ILogger&gt;().Is&lt;Logger&gt;();
  
      // this has to configure to choose logger passing DbAppender.
               x.For&lt;IHelloDbService&gt;().Use&lt;HelloServiceWithDbLog&gt;();
                  .Ctor&lt;ILogger&gt;().Is&lt;Logger&gt;();
  </code></pre>