title: How to automatically resolve named type in Autofac?
body: <p>In Unity, I can register a named type like this</p>
  
  <pre><code>using Microsoft.Practices.Unity;
  var container = new UnityContainer();
  container.RegisterType&lt;IOutputService, ConsoleOutputService&gt;("Console");
  container.RegisterType&lt;IOutputService, MessageBoxOutputService&gt;("MessageBox");
  container.RegisterType&lt;ICalculatorReplLoop, CalculatorReplLoop&gt;();
  ICalculatorReplLoop loop = container.Resolve&lt;ICalculatorReplLoop&gt;();
  </code></pre>
  
  <p>and auto resolve it using attribute like this</p>
  
  <pre><code>public class CalculatorReplLoop : ICalculatorReplLoop
  {
      public CalculatorReplLoop() {}
  
      [Dependency("MessageBox")]
      public IOutputService OutputService { get; set; }
  }
  </code></pre>
  
  <p>I know how to register Named Service in Autofac</p>
  
  <pre><code>using Autofac;
  using Autofac.Core;
  var builder = new ContainerBuilder();
  builder.RegisterType&lt;ConsoleOutputService&gt;().Named&lt;IOutputService&gt;("Console");
  builder.RegisterType&lt;MessageBoxOutputService&gt;().Named&lt;IOutputService&gt;("MessageBox");
  builder.RegisterType&lt;CalculatorReplLoop&gt;().As&lt;ICalculatorReplLoop&gt;().SingleInstance();
  IContainer container = builder.Build();
  ICalculatorReplLoop loop = container.Resolve&lt;ICalculatorReplLoop&gt;();
  </code></pre>
  
  <p>but how to resolve it inside CalculatorReplLoop class ?</p>