ORM / DAO / DataMapper / ActiveRecord / TableGateway差异? [英] ORM/DAO/DataMapper/ActiveRecord/TableGateway differences?

查看:225
本文介绍了ORM / DAO / DataMapper / ActiveRecord / TableGateway差异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请向我解释以下数据库代表在PHP中的区别:

Can you, please, explain me the differences between the following database representatives, say, in PHP.:

ORM
DAO
DataMapper
ActiveRecord
TableGateway

ORM DAO DataMapper ActiveRecord TableGateway

任何例子都会感激。

推荐答案

这将需要一个很长的答案。我不会重复他人说的更好,更详细的在我面前,我链接到一些相关的页面。我建议通过他们。也许跟随几个额外的链接。维基百科总是一个好的开始。如果你在通过链接后还有任何关于一个或另一个模式的问题,请随时回到SO并再次询问。但如果你这样做,试着把它缩小。最好问多个问题,关注某些方面,而不是期望人们为你写一篇文章。

That would require a pretty long answer. Instead of repeating what others have said better and in more detail before me, I link you to some relevant pages. I suggest to look through them. Maybe follow a few additional links. Wikipedia is always a good start. If you still have any questions about one or the other pattern after going through the links, feel free to come back to SO and ask again. But if you do, try to narrow it down. It's better to ask multiple questions and focus on particular aspects than expecting people to write an essay for you.

对象关系映射器

Object Relational Mapper


计算机软件中的对象关系映射(ORM,O / RM和O / R映射)是用于在关系数据库和面向对象编程语言中的不兼容型系统之间转换数据的编程技术。

Object-relational mapping (ORM, O/RM, and O/R mapping) in computer software is a programming technique for converting data between incompatible type systems in relational databases and object-oriented programming languages.

数据访问对象

Data Access Object


使用数据访问对象(DAO)抽象和封装对数据源的所有访问。 DAO管理与数据源的连接以获取和存储数据。

Use a Data Access Object (DAO) to abstract and encapsulate all access to the data source. The DAO manages the connection with the data source to obtain and store data.

DataMapper

DataMapper


的映射器(473),它在对象和数据库之间移动数据,同时保持它们彼此独立和映射器本身。

A layer of Mappers (473) that moves data between objects and a database while keeping them independent of each other and the mapper itself.

> Active Record

Active Record

在数据库表或视图中包装行的对象封装了数据库访问,并在该数据上添加了域逻辑。

An object that wraps a row in a database table or view, encapsulates the database access, and adds domain logic on that data.

表数据网关

Table Data Gateway


充当数据库表的网关(466)的对象。一个实例处理表中的所有行。

An object that acts as a Gateway (466) to a database table. One instance handles all the rows in the table.

这篇关于ORM / DAO / DataMapper / ActiveRecord / TableGateway差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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