title: Ninject into a Webactivator invoked class
body: <p>I use the nuget template way of ninjectning my MVC3 app,
  which means I have use WebActivator to invoke a method on a static class that in turn creates a Ninject bootstrapper and hooks up to MVC3.</p>
  
  <p>That works fine for Controller, adapters etc. But I want to have another Webactivator activated class which gets its dependencies using Ninject.</p>
  
  <p>I got it to work with a poor mans solution, but I would prefer a more elegant solution.</p>
  
  <p>First I make sure my Webactivator class uses the PostApplicationStartMethod invoke, since the Ninject module uses the PreApplicationStartMethod I can ensure that ninject has been loaded and is ready to go.. THen in the Start method I do</p>
  
  <pre><code>var workers = DependencyResolver.Current.GetServices&lt;IWorker&gt;();
  </code></pre>
  
  <p>To get my dependencies, the whole class looks like this</p>
  
  <pre><code>[assembly: WebActivator.PostApplicationStartMethod(typeof(SHB.DALA.Web.App_Start.WorkflowRunner), "Start")]
  
  namespace SHB.DALA.Web.App_Start
  {
      public static class WorkflowRunner 
      {
          public static void Start()
          {
              var workers = DependencyResolver.Current.GetServices&lt;IWorker&gt;();
              //Do stuff with worker collection
          }
      }
  }
  </code></pre>
  
  <p>There must be a more elegant solution right?</p>