title: Replace factory with AutoFac
body: <p>I'm accustomed to creating my own factories as shown (this is simplified for illustration):</p>
  
  <pre><code>public class ElementFactory
  {
      public IElement Create(IHtml dom)
      {
          switch (dom.ElementType)
          {
              case "table":
                  return new TableElement(dom);
              case "div":
                  return new DivElement(dom);
              case "span":
                  return new SpanElement(dom);
          }
          return new PassthroughElement(dom);
      }
  }
  </code></pre>
  
  <p>I'm finally getting around to using an IoC container (AutoFac) in my current project, and I'm wondering is there some magic way of achieving the same thing elegantly with AutoFac?</p>