title: Why would you use Windsor AsFactory?
body: <p>Why would you use Castle Windsor factory auto implementation feature: AsFactory() rather then asking for needed interface?</p>
  
  <p>Example:</p>
  
  <pre><code>container.Register(Component.For&lt;IEmailSender&gt;().ImplementedBy&lt;SmtpEmailSender&gt;());
  container.Register(Component.For&lt;IEmailSenderFactory&gt;().AsFactory().LifeStyle.Transient);
  </code></pre>
  
  <p>...</p>
  
  <pre><code>using (var factory = context.GetServiceFactory&lt;IEmailSenderFactory&gt;())
  {
      var emailSender = factory.CreateEmailSender();
      emailSender.Send(message);
  }
  </code></pre>
  
  <p>Why wouldn't you simply write:</p>
  
  <pre><code>var emailSender = context.GetServiceFactory&lt;IEmailSender&gt;();
  emailSender.Send(message);
  </code></pre>
  
  <p>Effect is the same. Windsor will resolve IEmailSender as default registered implementation anyway so what is the point?</p>