title: Using a DynamicProxy interceptor with dependencies in StructureMap Registry
body: <p>I have the following code:</p>
  
  <pre><code>_container = new Container(x =&gt; x.AddRegistry&lt;ManagerRegistry&gt;());
  </code></pre>
  
  <p>-</p>
  
  <pre><code>public class ManagerRegistry : Registry
  {
      public ManagerRegistry()
      {
          var proxyGenerator = new ProxyGenerator();
  
          For&lt;IPersonManager&gt;()
              .EnrichAllWith(t =&gt; proxyGenerator.CreateInterfaceProxyWithTarget(
                                  t, new AuthenticationInterceptor()))
              .Use&lt;PersonManager&gt;();
      }
  }
  </code></pre>
  
  <p>-</p>
  
  <pre><code>public class AuthenticationInterceptor : IInterceptor
  {
      public void Intercept(IInvocation invocation)
      {
          if (!HttpContext.Current.User.IsInRole("Monkey"))
              throw new Exception("Only monkeys allowed!");
  
          invocation.Proceed();
      }
  }
  </code></pre>
  
  <p>It <strong>interceps</strong> the creation of a <strong>dependency in StructureMap</strong>, and <strong>decorates</strong> it <strong>using DynamicProxy</strong>.<br />
  Now this works fine, because the <strong>interceptor</strong> has no <strong>dependencies itself</strong>.</p>
  
  <p>But given the following:</p>
  
  <pre><code>public class LoggingInterceptor : IInterceptor
  {
      public LoggingInterceptor(ILogger logger)
      {
  </code></pre>
  
  <p><strong>How</strong> would I go about <strong>wiring</strong> that <strong>up in StructureMap</strong>?</p>