title: Ninject - Constructor Argument from Session
body: <p>We are building a multi-tenant database application utilizing ASP.NET MVC, the Entity Framework Code First, and the soon to be released SQL Azure Federations.  Our repository accepts a DbContext as a constructor argument that is injected using Ninject.  The problem is that the DbContext has an int constructor argument to specify the account id that will be used for the requests made with that context.  Something like this:</p>
  
  <pre><code>public class DatabaseContext : DbContext
  {
       public DatabaseContext(int accountId)
       {
            // Code here to ensure we only work with data associated with 
            // the account identified by accountId
       }
  }
  </code></pre>
  
  <p>The value for the account id will be stored in a Session variable.  The question is how do we get Ninject to inject a value from Session into the constructor when it creates a new instance of DatabaseContext?</p>
  
  <p>Or is there another way I should go about injecting the account id into the DbContext?</p>