DAL和ORM之间的连线在哪里? [英] Where is the line between DAL and ORM?
问题描述
例如,假设我有一些实现数据库,表,列和行类的代码,通过对现有数据库的自动分析来填充它们,允许简化交互等。它了解,执行和利用数据库实体之间的结构关系,如外键。所有的实体模型都可以被子类化以将特定于表的功能加载到它们上。
DAL在多大程度上ORM在多大程度上?为什么?
ORM =对象关系映射
ORM,应用程序中的类/对象映射到数据库表和持久性操作,有时是自动进行的。
DAL =数据访问层
在DAL中,数据库操作隐藏在代码外观后面。
ORM是一种DAL,但并不是所有的DAL都是ORM。
The terms are often thrown around interchangeably, and there's clearly considerable overlap, but just as often it seems implied that people see something strongly implied by saying that a system is an ORM that isn't implied by it being a DAL. What is that? What, if any, are the key points that differentiate these types of system?
For example, let's say I have some code that implements Database, Table, Column and Row classes, populating them by automatic analysis of an existing database, allowing simplified interaction and so on. It understands, enforces, and takes advantage of structural relationships between database entities, such as foreign keys. All the entity models can be subclassed to load table-specific functionality onto them.
To what extent is this a DAL? To what extent is it an ORM? Why?
ORM = Object-Relational Mapping
In an ORM, classes/objects in the application are mapped to database tables and operations for persistence, sometimes automagically.
DAL = Data-Access Layer
In a DAL, database operations are hidden behind a code facade.
An ORM is a kind of DAL, but not all DALs are ORMs.
这篇关于DAL和ORM之间的连线在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!