title: Register IOC container to self
body: <p>Let's say I have an interface IDependencyResolver:</p>
  
  <pre><code>public interface IDependencyResolver{
      T Resolve&lt;T&gt;() where T: class;
      object Resolve(Type source);
  }
  </code></pre>
  
  <p>And an implementation with the use of SimpleInjector:</p>
  
  <pre><code>public class SIDependencyResolver:IDependencyResolver{
      private readonly Container _container;
      public SIDependencyResolver(Container container){
          _container = container;
          _container.Options.DefaultScopedLifestyle = new WcfOperationLifeStyle();
          RegisterDependencies(_container, LifeStyle.Scoped);
      }
      public T Resolve&lt;T&gt;() where T:class{
          return _container.GetInstance&lt;T&gt;();
      }
      public object Resolve(Type source){
          return _container.GetInstance(source);
      }
      public void RegisterDependencies(Container container, LifeStyle lifeStyle){
          //register dependencies + register self
      }
  }
  </code></pre>
  
  <p>What do I need to do if I need the IDependencyResolver injected in a constructor which uses the Service locator pattern? (yes, I know... an anti-pattern... but this aside)</p>
  
  <pre><code>public class UnitOfWork: IUnitOfWork{
      private readonly IDependencyResolver _resolver;
      public UnitOfWork(IDependencyResolver resolver){
          _resolver = resolver;
      }
      public IReadRepository&lt;T&gt; Read&lt;T&gt;(){
          return _resolver.Resolve&lt;IReadRepository&lt;T&gt;&gt;();
      }
      public IWriteRepository&lt;T&gt; Write&lt;T&gt;(){
          return _resolve.Resolve&lt;IWriteRepository&lt;T&gt;&gt;();
      }
  }
  </code></pre>
  
  <p>In the past I always registered the dependency resolver self as a singleton, so not with a scoped lifestyle since that gave me problems.</p>
  
  <pre><code>container.Register&lt;IDependencyResolver, SIDependencyResolver&gt;(LifeStyle.Singleton);
  </code></pre>
  
  <p>First of all, is this the correct way (for example in case of WCF scope, with a singleton lifestyle) to do this or is there another way to do this?<br/>
  Second, is it correct to pass the SimpleInjector.Container to the constructor of my dependencyResolver?</p>