阅读背景:

Linq to SQL:为每个页面或全局页面设置一个小的DataContext会更好吗?

来源:互联网 

I am trying out Linq to SQL in an ASP.NET application that uses a large database with lots of foreign keys (100+ tables). I am impressed with how Linq permits you to create a datacontext with all of your relationships intact and to then create Linq statements that automatically join tables. However, this leads to a question: if I am submitting a Linq statement that just works with one or two tables, is it better to have a datacontext that just has the necessary table/tables? It seems to me that if I build a datacontext with all of the tables in the database, it would be quite massive and loading it for every use of Linq would have a negative impact on performance. Am I right?I am trying out Linq to SQL in an ASP.NET appli




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: