So I had an architect on a previous project who railed against Datasets. He hated them, and said they had no place in a web application, specifically a web app which will have a lot of traffic.
所以我在之前的项目中有一位建筑师,他反对数据集。他讨厌他们,并说他们在网络应用程序中没有位置,特别是一个会有大量流量的网络应用程序。
I've noticed in many instances of code I've taken over that Datasets are used quite heavily.
我注意到在许多代码中我接管了数据集的使用非常多。
Are they really that bad/performance killing?
他们真的那么糟糕/性能杀戮吗?
Should I think about gutting the application of it's heavy use of datasets and replace them with lists populated via data readers?
我是否应该考虑使用数据集来大量使用数据集并将其替换为通过数据读取器填充的列表?
I'm curious to hear what you all have found on the topic, or what your preference is.
我很想知道你们在这个主题上发现了什么,或者你的偏好是什么。
Thanks again guys!data
再次感谢大家!数据
4 个解决方案
#1
Dino Esposito article DataSets vs. Collections might be a good reference in comparing between using Dataset vs Collections.
Dino Esposito文章DataSets vs. Collections可能是比较使用Dataset和Collections之间的一个很好的参考。
My preference is using Domain (Business Objects) and Collections by following the concept of Domain Driven Design combined with using NHibernate for the data persistence and also Dependency Injection
我喜欢使用Domain(Business Objects)和Collections,遵循域驱动设计的概念,结合使用NHibernate进行数据持久性以及依赖注入
#2
I don't have anyproblem with Datasets though I would expect that I would find performance problems if I stored alot of them in Session (particularily an out of process provider) or had to serialize them across a web service call. For the most part in reasonably simple two or small three teir structures I haven't found them a problem.
我对数据集没有任何问题,但我希望如果我在Session(特别是一个流程外提供者)中存储了很多这些问题,或者不得不在Web服务调用中序列化它们,我会发现性能问题。在大多数情况下,在相当简单的两个或三个小型teir结构中,我没有发现它们是个问题。
I would also attempt to make sure that the data layer wasn't returning more data than I acutally needed for the page.
我还会尝试确保数据层没有返回比我真正需要的页面更多的数据。
#3
Datasets are basically a small, in-memory database, which is why you were told that, in a web application with a large number of users, datasets will not scale well, because they will use up memory on the web server.
数据集基本上是一个小型的内存数据库,这就是为什么你被告知,在拥有大量用户的Web应用程序中,数据集不能很好地扩展,因为它们会耗尽Web服务器上的内存。
Whether or not you should replace the datasets in your current application depends on whether or not your application is having problems scaling (working with a significant number of users) because of the datasets.
是否应该替换当前应用程序中的数据集取决于您的应用程序是否因为数据集而缩放(与大量用户一起工作)时出现问题。
I too prefer using more sophisticated tools to build web applications, but I hesitate to throw a lot of ten dollar words at you if you are still using datasets and dataadapters to run your web application. Datasets and data adapters are a perfectly good way to build a website.
我也更喜欢使用更复杂的工具来构建Web应用程序,但如果您仍在使用数据集和数据适配器来运行Web应用程序,我会犹豫不决。数据集和数据适配器是构建网站的绝佳方式。
The thing you have to remember about a dataset is that it is an in-memory representation of data, and it is randomly accessible; whereas a data adapter is a forward-only reader, but it is very fast and it requires very little memory (enough for a single record). A dataset in a web application should typically be kept very small if possible.
关于数据集,你必须要记住的是它是数据的内存中表示,它是随机可访问的;而数据适配器只是一个前向读卡器,但它非常快,而且只需要很少的内存(足以用于单个记录)。如果可能,Web应用程序中的数据集通常应保持非常小。
#4
Performance isn't a real concern unless you have a reason for it to be. Performance with datasets can be either quite good or quite poor, depending on how you use them -- that's the important thing.
除非你有理由,否则表现并不是真正令人担忧的问题。数据集的性能可能非常好或非常差,这取决于您如何使用它们 - 这是重要的。
The real PITA with datasets is that they're relatively hard to work with in comparison to the much richer technologies that you have at your disposal like LINQ 2 SQL/Entities and NHibernate. They're also a pain to use regular LINQ over, compared to object collections.
带有数据集的真正的PITA是,与您可以使用的更丰富的技术(如LINQ 2 SQL / Entities和NHibernate)相比,它们相对难以使用。与对象集合相比,使用常规LINQ也很痛苦。
#1
Dino Esposito article DataSets vs. Collections might be a good reference in comparing between using Dataset vs Collections.
Dino Esposito文章DataSets vs. Collections可能是比较使用Dataset和Collections之间的一个很好的参考。
My preference is using Domain (Business Objects) and Collections by following the concept of Domain Driven Design combined with using NHibernate for the data persistence and also Dependency Injection
我喜欢使用Domain(Business Objects)和Collections,遵循域驱动设计的概念,结合使用NHibernate进行数据持久性以及依赖注入
#2
I don't have anyproblem with Datasets though I would expect that I would find performance problems if I stored alot of them in Session (particularily an out of process provider) or had to serialize them across a web service call. For the most part in reasonably simple two or small three teir structures I haven't found them a problem.
我对数据集没有任何问题,但我希望如果我在Session(特别是一个流程外提供者)中存储了很多这些问题,或者不得不在Web服务调用中序列化它们,我会发现性能问题。在大多数情况下,在相当简单的两个或三个小型teir结构中,我没有发现它们是个问题。
I would also attempt to make sure that the data layer wasn't returning more data than I acutally needed for the page.
我还会尝试确保数据层没有返回比我真正需要的页面更多的数据。
#3
Datasets are basically a small, in-memory database, which is why you were told that, in a web application with a large number of users, datasets will not scale well, because they will use up memory on the web server.
数据集基本上是一个小型的内存数据库,这就是为什么你被告知,在拥有大量用户的Web应用程序中,数据集不能很好地扩展,因为它们会耗尽Web服务器上的内存。
Whether or not you should replace the datasets in your current application depends on whether or not your application is having problems scaling (working with a significant number of users) because of the datasets.
是否应该替换当前应用程序中的数据集取决于您的应用程序是否因为数据集而缩放(与大量用户一起工作)时出现问题。
I too prefer using more sophisticated tools to build web applications, but I hesitate to throw a lot of ten dollar words at you if you are still using datasets and dataadapters to run your web application. Datasets and data adapters are a perfectly good way to build a website.
我也更喜欢使用更复杂的工具来构建Web应用程序,但如果您仍在使用数据集和数据适配器来运行Web应用程序,我会犹豫不决。数据集和数据适配器是构建网站的绝佳方式。
The thing you have to remember about a dataset is that it is an in-memory representation of data, and it is randomly accessible; whereas a data adapter is a forward-only reader, but it is very fast and it requires very little memory (enough for a single record). A dataset in a web application should typically be kept very small if possible.
关于数据集,你必须要记住的是它是数据的内存中表示,它是随机可访问的;而数据适配器只是一个前向读卡器,但它非常快,而且只需要很少的内存(足以用于单个记录)。如果可能,Web应用程序中的数据集通常应保持非常小。
#4
Performance isn't a real concern unless you have a reason for it to be. Performance with datasets can be either quite good or quite poor, depending on how you use them -- that's the important thing.
除非你有理由,否则表现并不是真正令人担忧的问题。数据集的性能可能非常好或非常差,这取决于您如何使用它们 - 这是重要的。
The real PITA with datasets is that they're relatively hard to work with in comparison to the much richer technologies that you have at your disposal like LINQ 2 SQL/Entities and NHibernate. They're also a pain to use regular LINQ over, compared to object collections.
带有数据集的真正的PITA是,与您可以使用的更丰富的技术(如LINQ 2 SQL / Entities和NHibernate)相比,它们相对难以使用。与对象集合相比,使用常规LINQ也很痛苦。