asp.net - Is opening too many datacontexts bad? -


I am checking my application with linq 2 sql profiler, and I have found that it opens up many datacontacts , Most of which are opened by the source data used by them, since my repositories only use the example stored in the request. ITIs, is it bad to open a lot of datacontext? And how can I create my linqdatasource to use datacentext which I store in the request. For the duration of the request? Thanks for any help!

If you open them and close them, of course not at all.

But if you are inside a TransactionScope, the game changes! Opening and closing of many nested datacattaxes makes us very difficult because it is due to our transaction promoting distributed transactions, which slowed our system down and seriously discontinued our system's scalability.


Comments