title: asp.net mvc 4 - Okay to share DbContext per thread?
body: <p>From <a href="https://stackoverflow.com/questions/10585478/one-dbcontext-per-web-request-why">One DbContext per web request... why?</a></p>
  
  <p>My understanding is that a DbContext instance should not be shared across concurrent web request, so definitely not across threads.
  But how about sharing it across non-concurrent web requests?</p>
  
  <p>Due to <em>thread agility</em> (<a href="https://stackoverflow.com/questions/11306888/what-is-the-meaning-of-thread-agility-in-asp-net">What is the meaning of thread-agility in ASP.Net?</a>), am I right that a thread can handle more than one web request before it dies?</p>
  
  <p><strong>If so, is it safe to dependency inject a DbContext instance for each thread?</strong></p>
  
  <p>Reason for this is I'm using Unity, which does not include per-request lifetime option.
  From <a href="https://stackoverflow.com/questions/5187562/mvc-ef-datacontext-singleton-instance-per-web-request-in-unity">MVC, EF - DataContext singleton instance Per-Web-Request in Unity</a> , I think I could use a custom LifetimeManager; I'm just wondering if it is safe and sufficient to use PerThreadLifetimeManager.</p>