title: Autofac - Lifetime and modules
body: <p><strong>Problem (abstract)</strong></p>
  
  <p>Given a module which registers dependency X. The dependency X has a different lifetime in a MVC3 app (lifetime per HttpRequest) then in a console application (dependency per lifetimescope with a name). Where or how to specify the lifetime of dependency X?</p>
  
  <p><strong>Case</strong></p>
  
  <p>I've put all my database related code in a assembly with a module in it which registers all repositories. Now the ISession (Nhibernate) registration is also in the module.</p>
  
  <p>ISession is dependency X (in the given problem case). ISession has different lifetime in a MVC3 app (lifetime per request) then in a console app where I define a named lifetimescope. </p>
  
  <p>Should the registration of ISession be outside the module? Would be strange since it's an implementation detail. </p>
  
  <p>What is the best case to do here? Design flaw or are there smart constructions for this :) ?</p>