title: LightInject: Constructor Injection and IDisposable
body: <p>I'd like to use LightInject's constructor injection feature, but I'd like to clear up things first about lifetime management of IDisposables.</p>
  
  <p>Consider the following:</p>
  
  <p><strong>Example A</strong></p>
  
  <pre><code>public class Foo : IDisposable
  {
      readonly IBar bar;
      public Foo(IBar bar)
      {
          this.bar = bar;
      }
  
      public void Dispose()
      {
  
      }
  }
  </code></pre>
  
  <p><strong>Example B</strong></p>
  
  <pre><code> public class Foo : IDisposable
   {
      readonly IBar bar;
      public Foo(Func&lt;string, IBar&gt; bar)
      {
          this.bar = bar("myParameter");
      }
  
      public void Dispose()
      {
  
      }
   }
  </code></pre>
  
  <p>My questions for both examples:</p>
  
  <ol>
  <li>Will Dispose method be called by LightInject on IBar after Foo is disposed or should I call dispose myself?</li>
  <li>If IBar is using a PerContainerLifeTime, will Dispose be called after every Foo instance disposed?</li>
  </ol>
  
  <p><strong>Edit</strong>
  Well the 2nd question is stupid I realize, a PerContainerLifeTime instance is of course disposed when the container is Disposed.
  My overall question would be, is LightInject tracking injected dependencies, and dispose them itself?</p>