ASP.NET数据集VS Business Objects公司/ ORM [英] ASP.NET DataSet vs Business Objects / ORM

查看:177
本文介绍了ASP.NET数据集VS Business Objects公司/ ORM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是通过ASP.NET应用程序的数据访问思考。从使用了大量的Windows应用程序与客户端数据公司即将设置有对处理数据的一个DataSet的方法自然dendancy。

I'm thinking through data access for an ASP.NET application. Coming from a company that uses a lot of Windows applications with Client Data sets there is a natural dendancy towards a DataSet approach for dealing with data.

我在一个业务对象的方法更激烈,我不喜欢在会话中缓存数据集,然后应用更新的想法。

I'm more keen on a Business Object approach and I don't like the idea of caching a DataSet in the session then applying an update.

有没有人有任何经验/帮助传递有关这两种方法的优点和缺点是什么?

Does anyone have any experience / help to pass on about the pros and cons of both approaches?

推荐答案

您是聪明的思考在你的应用程序设计数据层。在ASP.NET应用程序,这将帮助您标准化和pretty极大地简化数据访问。您的将会的需要学习如何创建和使用ObjectDataSources但是这是非常简单的。

You are smart to be thinking of designing a Data Layer in your app. In an ASP.NET application this will help you standardize and pretty dramatically simplify your data access. You will need to learn how to create and use ObjectDataSources but this is quite straightforward.

一个数据访问层(使用单独的项目/ DLL构建)的另一个优点是,它使单元测试要简单得多。我也建议你建立一个业务层做很多数据的处理(业务层,例如,将负责从DAL拉ObjectDataSources手到UI code)。这不仅让你封装业务逻辑,提高了code的可测试性为好。

The other advantage of a data access layer (built using a separate project/DLL) is that it makes Unit testing much simpler. I'd also encourage you to build a Business Layer to do much of the processing of data (the business layer, for example, would be responsible for pulling ObjectDataSources from the DAL to hand to the UI code). Not only does this let you encapsulate your business logic, it improves the testability of the code as well.

您做的的希望在会话缓存数据集(或DAL对象,对于这个问题)!您将构建一个Web应用程序,以便记录修改通过一个独特的ID(或其他主键规范)工作,并直接反馈更改DAL,因为它们制成。如果你要缓存一切你所的显着的减少您的应用程序的可伸缩性。

You do not want to be caching DataSets (or DAL objects, for that matter) in the session! You will build a Web app so that record modifications work through a Unique ID (or other primary key spec) and feed changes directly to the DAL as they are made. If you were to cache everything you would dramatically reduce the scalability of your app.

更新:在此线程其他正在推动使用的ORM的想法。我会谨慎采用一个完全成熟的ORM,我有previously概述<一原因href=\"http://stackoverflow.com/questions/458802/doesnt-linq-to-sql-miss-the-point-arent-orm-mappers-subsonic-etc-sub-opti\">here和<一个href=\"http://stackoverflow.com/questions/640004/is-linqtosql-powerful-enough-isnt-a-more-powerful-but-equally-fluent-interface\">here.我的的同意,不过,这将是明智的,以避免数据集。在我自己的工作,我广泛使用的DataReader来填补我的ObjectDataSources(这是微不足道的,由于我的DAL的设计),并发现它是非常有效的。

Update: Others on this thread are promoting the idea of using ORMs. I would be careful about adopting a full-blown ORM for reasons that I have previously outlined here and here. I do agree, though, that it would be wise to avoid DataSets. In my own work, I make extensive use of DataReaders to fill my ObjectDataSources (which is trivial due to the design of my DAL) and find it to be very efficient.

这篇关于ASP.NET数据集VS Business Objects公司/ ORM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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