The major subject in .net programs is "How manage memory for best performance". so Microsoft use garbage collector in .net and with that, we don't need to do so开发者_开发知识库mething for managing memory(or better say we can use GC easily)
But when you develop big project(business app), you make too many tables and database for your own project. so if you use Linq-to-sql, we must build DataContext include hundred or more tables. That make problem for program when you create an object from datacontext, that object give big amount of memory. also we cant divide datacontext to datacontexts(cuz relation between tables)
so "How manage datacontext and memory"?
As Midhat already commented, big databases with hundreds of tables and huge amounts of data should not be any problem for LINQ to SQL or any O/RM tool what so ever. Perhaps you're doing something wrong. If you're having problems, try posting some code here so we can take a look. Perhaps the problem is that you're caching a single DataContext
. Yes, this will go wrong. I just answered a similar question here at SO, that might interest you. Read it while it's hot.
See this for example - "Linq to SQL DataContext Lifetime Management": http://www.west-wind.com/weblog/posts/246222.aspx This approach makes life simpler.
精彩评论