title: Create instance of a class with dependencies using Autofac
body: <p><strong>Problem:</strong></p>
  
  <p>Assume the class:</p>
  
  <pre><code>public class MyAwesomeClass
  {
     private IDependCls _dependCls;
     public MyAwesomeClass(IDependCls dependCls)
     {
         _dependCls = dependCls;
     }
  
  }
  </code></pre>
  
  <p>And somewhere else I need to get an instance of that class, like so:</p>
  
  <pre><code>public class SomewhereElse
  {
      public void AwesomeMethod()
      {
          //...
          // AwesomeStuff
          //...
  
          var GetErDone = new MyAwesomeClass();  // PROBLEM! No constructor with 0 arguements
      }
  }
  </code></pre>
  
  <p>Question is, do I </p>
  
  <p><strong>Proposed solution 1:</strong></p>
  
  <p>A) have to make an extra constuctor that resolves the dependency? For example:</p>
  
  <pre><code>   public MyAwesomeClass() // new constructor
     {
         _dependCls = DependencyResolver.Current.GetService&lt;IDependCls&gt;();
     }
  
  
  public class SomewhereElse
  {
      public void AwesomeMethod()
      {
          var GetErDone = new MyAwesomeClass();  // IT WORKS!!
      }
  }
  </code></pre>
  
  <p><strong>Proposed solution 2:</strong></p>
  
  <p>B) use the resolver inside <code>AwesomeMethod</code> right before  <code>var GetErDone</code></p>
  
  <pre><code>public class SomewhereElse
  {
      public void AwesomeMethod()
      {
          var depCls = _dependCls = DependencyResolver.Current.GetService&lt;IDependCls&gt;();
          var GetErDone = new MyAwesomeClass(depCls);  // IT WORKS!!
      }
  }
  </code></pre>
  
  <p><strong>Autofac solution?</strong></p>
  
  <p>C) Some other Autofac way?</p>
  
  <p>Looking for best practices, as well as a good Autofac solution if possible. I think the first way is the worst as optional dependancies could lead to a lot of clutter.</p>
  
  <p><strong>Summary:</strong></p>
  
  <p>How do I get a <code>new MyAwesomeClass()</code> when <code>MyAwesomeClass</code> has dependencies?</p>