I'm working with the ASP.net Web API for a simple REST api. I'm using Linq for my data access layer and was newing up a new linq datacontext for every api call. But it seemed a bit resource intensive to create a new data context for every call, so I started thinking about moving the datacontext to single application-level variable which would be instantiated in the global.asax.
Each api function is simply performing straightforward CRUD operations on a single table. I understand there are some concurrency issues if with this approach. But in reality all tables are partitioned by users so 2 different users could not update or delete the same rows on any table. Also since its an api I'm calling datacontext.submitchange() after every change so there any single user could update the same row at the same time.
So beside the concurrency issue, are there other concerns which managing a datacontext at the global level vs. instantiating on every api call? Are there other approaches that might also achieve the performance/resource benefits of the application-level instantiation?