title: Autofac multiple implementations xml configuration
body: <p>Is it possible to configure multiple implementations of the same interface with the autofac xml configuration?</p>
  
  <p>What i'm trying to accomplish is a windows service which executes multiple jobs. I have 2 jobs which are sending messages from a queue by sms or email. Every job is a different assembly. They both depend on IQueuedMessageProvider. One job needs the email implementation the other one the sms implementation.The constructor for both jobs look like this (simplified for question):</p>
  
  <pre><code> public SendSmsJob(IQueuedMessageProvider queuedMessageProvider)
      {
          _queuedMessageProvider= queuedMessageProvider;
      }
   public SendEmailJob(IQueuedMessageProvider queuedMessageProvider)
      {
          _queuedMessageProvider= queuedMessageProvider;
      }
  </code></pre>
  
  <p>In the app.config I registered the implementations like</p>
  
  <pre><code>&lt;component type="MyApp.Plugin.Sms.Verizon.VerizonSmsService, MyApp.Plugin.Sms.Verizon" service="MyApp.Model.Messages.QueuedMessages.Providers.IQueuedMessageProvider, MyApp.Model" /&gt;
  &lt;component type="MyApp.Plugin.Email.Smtp.EmailService, MyApp.Plugin.Email" service="MyApp.Model.Messages.QueuedMessages.Providers.IQueuedMessageProvider, MyApp.Model" /&gt;
  </code></pre>
  
  <p>How can I make sure the job gets the right implementation of de IQueuedMessageProvider? I have read about solving these kind of problems with names and keys <a href="https://code.google.com/p/autofac/wiki/TypedNamedAndKeyedServices" rel="nofollow">https://code.google.com/p/autofac/wiki/TypedNamedAndKeyedServices</a>. </p>
  
  <p>Another option is register all implementations and make IQueuedMessageProvider an IEnumerable and take the right implementation in the constructor. But I prefer to solve it in the configuration it self. Is it even possible or do you have any better suggestions about solving this?</p>