什么是在任何应用程序中使用持久层?是在、应用程序、持久

2023-09-04 00:31:01 作者:空叹花语意

我要创建其中有人问我创建的应用程序中的持久层的应用程序。该应用程序是在.NET。我已经创建了业务层和presentation层,但我不知道如何和为什么要创造持久层。

I have to create an application in which I am asked to create an persistence layer in the application. The application is in .net. I have created business layer and presentation layer but I don't know how and why to create persistence layer.

我一派,才知道,持久层用于存储和数据库通常检索数据。

I googled and came to know that persistence layer is used for storing and retrieving data usually from a database.

能详细解释一下别人?

推荐答案

为您打造一个DAL(数据访问层)或任何其他类型的数据库引擎和业务/应用逻辑之间的中间层的原因,就是加入这一层在你们之间从你使用的是现在特定的数据库引擎/技术隔离应用程序的其它部分/上层。

the reason for you to build a DAL ( Data Access Layer ) or any other kind of intermediate layer between database engine and Business / Application logic, is that by adding this layer in the between you isolate the rest / upper layers of your application from the specific database engine / technology you are using right now.

这有几个好处,像其他存储引擎更容易迁移,单层更好的封装数据库逻辑的(更容易替代或更新版本修改取决于如何以及你设计的跨层接口等)

This has several advantages, like easier migration to other storage engines, better encapsulation of database logic in a single layer ( easier to replace or modify later depending on how well you have designed your cross-layer interfaces etc...)

看我最受好评的答案在这里,它是关于ASP.NET MVC和EF,但解决方案和项目的结构的一个例子实际上是技术无关的:的 MVC3和实体框架

see my most rated answer here, it is an example about ASP.NET MVC and EF but the structuring of solution and projects is actually technology independent: MVC3 and Entity Framework

也读过一些文章,以便更好地理解这件事情,例如: http://www.developerfusion.com/article/84492/net-and-data-persistence/

Also read some articles to better understand this matter, for example: http://www.developerfusion.com/article/84492/net-and-data-persistence/

 
精彩推荐