title: How to configure simple injector container and lifestylse in a MVC web app with WebAPI, WCF, SignalR and Background Task
body: <p>The simple injector documentation provides great examples on how to setup the container for WebRequest, Web API, WCF, ...  but the examples are specific to one technology/lifestyle at a time. Our web application uses most of them together!
  It is not clear to me how to configure the container to work with several lifestyles.</p>
  
  <hr>
  
  <p>Let's say I have a MVC project with Web API. I have the following objects:</p>
  
  <ul>
  <li>MyDbContext : My entity code first db context</li>
  <li>IMyDataProvider implemented by MyDataProvider : Contains query logic and uses MyDbContext</li>
  <li>MyController : MVC controller that uses IMyDataProvider</li>
  <li>MyApiController : WebApi controller that uses IMyDataProvider</li>
  </ul>
  
  <p>Should I create and configure one container for each type of lifestyle ?</p>
  
  <p>When I register everything with <code>RegisterPerWebRequest&lt;T&gt;</code> is works in both types of controllers. Is this safe ? Or will I run into trouble when using async/await in a Web API controller?</p>
  
  <p>What is the best configuration when I have both MVC and Web API controllers who get injected the same instances ?</p>
  
  <p>Should I use a hybrid lifestyle ?</p>
  
  <hr>
  
  <p>Now to complicate things... our application also uses background tasks and SignalR.</p>
  
  <p>Both of these will sometimes occur outside of a WebRequest and need access to the same objects as described above.</p>
  
  <p>The best solution would be to use a Lifetime scope ?</p>
  
  <p>Would I need to create a new container for that lifestyle? or can I reuse/reconfigure my MVC/Web API container ?</p>
  
  <p>Is there a triple lifestyle?</p>