简体   繁体   中英

.Net - SQL Server Data Sets, Best Practice: All tables in one DataSet or many small DataSets

My application has about 50 tables. Is it best to have one DataSet with with all the tables, or a number of smaller DataSets each with a few tables? I've been using one big DataSet and while that's easy to manage and use, it seems to be overburdening the Visual Studio 2010 DataSet Designer. It's taking a long time to open or save the data set and I'm thinking that it may also be slowing down the application though I haven't seen any major problems in that regard. Is there a rule or some decision points that someone could share?

Best practice is to not use datasets if you can avoid it. If you can avoid it, use lightweight entity objects from an auto generated DAL like the Microsoft Entity Framework, SubSonic, LLBLGen, etc.

If you absolutely can't avoid it... you are out of luck. By design, DataSets are slow lumbering beasts that are intended to be in memory transactional databases.

Edit:

I guess I never really answered your question.
If you are going to be using datasets regardless of their flaws, load only as much data as you need into them and with as few tables as possible. Try not to do expensive operations with them like serialization.

That is about all you can do to speed them up. Besides using another technology that is.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM