为什么我们仍然在 .NET 中使用 DataSet? [英] Why do we still use DataSets in .NET?

查看:30
本文介绍了为什么我们仍然在 .NET 中使用 DataSet?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

DataSets 是 .NET 1.0 中的大事之一,即使现在使用 .NET 3.5,我仍然发现自己不得不使用它们......尤其是当我必须调用一个返回数据集的存储过程时,我然后最终不得不手动转换为对象以使其更易于使用.

DataSets were one of the big things in .NET 1.0 and even now when using .NET 3.5 I still find myself having to use them....especially when I have to call a stored proc which returns a dataset which I then end up having to manually transform into an object to make it easier to work with.

我从来没有真正喜欢过 DataSet,并且发现它们使用起来很烦人......因此,我倾向于将我对它们的了解保持在最低限度(可能是一件非常糟糕的事情!).我也更喜欢将它们快速转换成一个对象或对象列表,这样我就可以在我的代码中轻松地操作它们.

I've never really liked DataSets and have found them annoying to use...and as a result I've tended to keep my knowledge about them to a bare minimum (probably a very bad thing!). I also prefer to quickly transform them into an object or list of objects so I can easily manipulate them in my code.

DataSet 是否按日期通过了使用?随着 NHibernate 等 O/R 映射器的出现,我想知道 DataSet 是否会消亡,或者它们还有一席之地吗?目前,我在是否应该留出时间重新访问 DataSet 并学习如何正确使用它们或 100% 落后于 O/R 映射器并完全放弃 DataSet 之间犹豫不决.

Have DataSets passed their use by date? With the advent of O/R mappers such as NHibernate, I'm wondering if DataSets will die out or is there still a place for them? At the moment, I'm torn between whether I should set aside time to revisit DataSets and learn how to use them properly or to get behind O/R mappers 100% and just ditch DataSets altogether.

DataSet 是否提供 NHibernate 和 LINQ 等技术无法提供的任何功能?如果不是,那我们为什么还要使用它们?

Do DataSets offer anything that technologies such as NHibernate and LINQ etc can't? If not, why then do we still use them?

推荐答案

我从来没有正确使用过 DataSet(连接到 SQL Server),但它曾经对特定需求很有用.我发现 DataSet 和 DataView 是非常方便且实用的基类,用于实现数据/BLL 层,直到我可以将一些经过深思熟虑的东西放在适当的位置.如果没有别的,您应该注意那里的许多功能.

I've never used a DataSet correctly (hooked up to an SQL Server), but it was useful for a particular need once. I found DataSet and DataView to be pretty handy and functional base classes for implementing a data/BLL tier until I could put something really thought-out in place. There's a lot of functionality back there that you should be aware of, if nothing else.

这篇关于为什么我们仍然在 .NET 中使用 DataSet?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆