Consider an ASP.NET Web API 2 application, that provides fairly straightforward access to several DB tables using Entity Framework.
Which of the following options for object lifecycles would be best in terms of servicing the most concurrent requests?
- Instantiating a singleton DbContext to be used by all requests.
- Instantiating one DbContext for each incoming request.
- Instantiating one DbContext for each thread in the thread pool servicing incoming requests?
- Other?
Follow up question - What if I change the requirement to "requiring the least amount of DB server resources"? What would then be the best option?