数据访问层的目的是什么? [英] What is the purpose of a Data Access Layer?

查看:137
本文介绍了数据访问层的目的是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很久以前开始了一个项目,并在我的解决方案中创建了一个数据访问层项目,但从未开发任何项目。数据访问层的目的是什么?有什么好的资料可以让我更多地了解数据访问层吗?

I started a project a long time ago and created a Data Access Layer project in my solution but have never developed anything in it. What is the purpose of a data access layer? Are there any good sources that I could learn more about the Data Access Layer?

推荐答案

用两个词:松散耦合

要保留用于提取数据的代码从您的数据存储区(数据库,平面文件,Web服务等)与业务逻辑和表示代码分开。这样,如果您必须更改数据存储,就不必重新编写整个内容。

To keep the code you use to pull data from your data store (database, flat files, web services, whatever) separate from business logic and presentation code. This way, if you have to change data stores, you don't end up rewriting the whole thing.

这些天,各种ORM框架都在将DAL与其他层。这通常使开发更容易,但是更改数据存储可能会很痛苦。公平地讲,像这样改变数据存储的情况很少见。

These days, various ORM frameworks are kind of blending the DAL with other layers. This typically makes development easier, but changing data stores can be painful. To be fair, changing data stores like that is pretty uncommon.

这篇关于数据访问层的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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