title: Dependency injected services used in a new task
body: <p>I'm using dependency injection to access my services when needed but i'm now wanting to create a concurrent task but this is causing issues due to dependency injected objects and their lifetimes.</p>
  
  <p>I've read this article (Heading: Prevents multi-threading): <a href="http://mehdi.me/ambient-dbcontext-in-ef6/" rel="noreferrer">Link</a>
  And from that, I've gathered that this isn't possible.</p>
  
  <p>My objective is to let the client send a request to begin a job that could take longer than the connection timeout of the client, thus I want to have an endpoint that initiates a task and returns the status of whether the task had successfully started. </p>
  
  <p>The problem is that because the database context and other services are created on the controller within the thread of the request, when you pass that object into a new task and end the old task, the objects are disposed due to the fact that they were created on said thread.</p>
  
  <p>I'm aware that for a database context you can inject the database factory interface and create a new instance but this doesn't help me for the non database objects. (I've also read that creating your own service instances defeats the point of dependency injection).</p>
  
  <p>Is there a way I can create a new instance of my injected dependencies on a new thread/task, or avoid this problem completely? Thanks.</p>