title: Bind Controller Context with Ninject
body: <p>I have a service class that is required to create a pdf, which needs the ControllerContext injected, in order to render a the <code>html =&gt; pdf</code>.
  This service is called through a middle tier, that has no reference to the web/mvc project. which is fine, since ninject does all the required injection of services etc.
  This is what the Service looks like (simplified for these purposes)</p>
  
  <pre><code>public class PdfCreatorService : AbstractUrlBasedPdfCreatorService
  {
      [Inject]
      public ControllerContext ControllerContext { get; set; }
  
      public override byte[] CreateReport(int reportId)
      {
          var result = new PdfController().CreateReport(reportId);
          using (var it = new ResponseCapture(ControllerContext.RequestContext))
          {
              result.ExecuteResult(ControllerContext);
              return it.ReadAllContents();
          }
      }
  }
  </code></pre>
  
  <p>Here is the simplified call stack:</p>
  
  <blockquote>
    <p>Web.HomeController.SendEmailWithPdf(int id) calls:<br>
    MiddleTier.BusinessLogic.SendEmailWithPdf(int id) calls:<br>
    Web.Services.PdfCreatorService.CreateReport(int id)</p>
  </blockquote>
  
  <p>Ninject is reaching PdfCreatorService, no problem, but: I need to somehow <strong>forward the ControllerContext from the HomeController (through the middle tier) to the PdfCreatorService</strong>.
  Whilst the middle tier cannot have any reference to the ControllerContext.</p>
  
  <p>I've looked at Providers, Factories, Resolver, etc.
  But couldn't find the right solution.</p>
  
  <p>Any help is appreciated!
  Cheers</p>