title: Understanding Autofac lifetime scopes
body: <p>From the documentation of Autofac, I understand that it keeps a reference to every IDisposable implementor that it creates. Therefore it can lead to OutOfMemoryException. So the suggested way to resolve dependencies is by using a ILifetimeScope.</p>
  
  <p>Assume IService implements IDisposable.</p>
  
  <pre><code>class MaintenanceTask {
      private IService service;
      public MaintenanceTask(ILifetimeScope lifetimeScope) {
          service = lifetimeScope.Resolve&lt;IService&gt;();
      }
      //...do your work
  }
  </code></pre>
  
  <p>But the problem with this approach is that it hides dependencies. I have to look at the code to see what that class depends on. Is there any other way to handle this in a more explicit way? More specifically, making dependencies more obvious without having to look at code? Or am I totally mistaken?</p>