数据访问库返回的DataSet对象或 [英] Data Access Library Return DataSet or Object

查看:147
本文介绍了数据访问库返回的DataSet对象或的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个普遍的共识在那里与库的调用存储过程时呢?返回的数据集或使用SqlDataReader对象来填充自定义对象?

Is there a general consensus out there for when working with library's that call stored procedures? Return datasets or use sqldatareader to populate custom objects?

时的序列化的成本你的数据传输对象不到一个DataSet?

Is the cost of serialization your Data Transport Object less then a DataSet?

推荐答案

我不得不与司法部达成一致,不必考虑NHibernate的(本书虽然这是一个很好的选择),我肯定会看看使用某种像NHibernate的,亚音速,LINQ的ORM的-to-SQL,LLBLGEN或周围的奥姆斯其他任何之一。

I'd have to agree with Justice, not necessarily about NHibernate (altho it's a great option) I would definately look at using some sort of ORM like NHibernate, Subsonic, Linq-to-sql, llblgen or any other one of the ORMs around.

作为的杰里米米勒指出:

如果你被
手工编写代码的ADO.Net,你从你的
雇主或客户偷窃。

if you're writing ADO.Net code by hand, you're stealing from your employer or client.

和为此,我不得不建议返回对象,而不是数据集或数据表。

and to that end, I'd have to recommend returning objects as opposed to datasets or datatables.

此外,如果你正在返回的数据集,除非你强类型每个数据集,你将不得不写很多解除代码库中的得到的值了数据集。随着ORM和对象所有繁重的为你做。

Also, if you're returning datasets, unless you strongly type each dataset, you're going to have to write a lot of "lifting" code in your library to get the values out of the datasets. With an ORM and objects all that heavy lifting is done for you.

最后,使用LINQ在C#你现在得到使用集合更好的功能(集合,分组排序,过滤等),其可以给数据集的优点。

Finally, with Linq in c# you now get much better functionality for working with collections (aggregates, grouping, sorting, filtering etc) that may have given datasets the advantage.

这篇关于数据访问库返回的DataSet对象或的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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