I’ve been checking my application with linq 2 sql profiler, and I noticed that it opens a lot of datacontexts, most of them are opened by the linq datasource I used, since my repositories use only the instance stored in Request.Items, is it bad to open too many datacontext? and how can I make my linqdatasource to use the datacontext that I store in Request.Items for the duration of the request? thanks for any help!
Share
If you open and close them, absolutely not.
But if you’re inside a TransactionScope, the game changes! Opening and closing many nested DataContexts bit us hard because it caused our transactions to promote to distributed transactions, which slowed down our system quite a bit and severely cut our system’s scalability.