问题描述
什么是数据访问对象和活动记录之间的区别?他们似乎不太一样,因为这两个构建的应用程序和持久化层,抽象掉直接访问数据库之间的一层使用SQL查询。
What's the difference between a Data Access Object and Active Record? They seem to be quite the same, as both built a layer between the application and persistence layer, and abstract away direct database access using SQL queries.
推荐答案
数据访问对象(DAO)是指物体在负责的领域坚持一个独立的实体数据层。活动记录是混合型,其中包含从表中单列的值类还负责查询,更新,插入和删除该表。活动记录设计模式意味着你的对象有一个一对一的映射与表在数据库中。
Data Access Object (DAO) refers to an object in your data layer responsible for persisting a separate entity in your domain. Active Record is hybrid where the class containing the values of a single row from a table is also responsible for queries, updates, inserts, and deletes to that table. The Active Record design pattern means your object has a one-to-one mapping with a table in your database.
这篇关于活动记录和DAO之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!