ORM 和持久性框架有什么区别?

发布于 2024-10-28 00:38:11 字数 87 浏览 6 评论 0原文

我正在阅读 OOP 设计模式和框架设计,发现自己对术语 ORM 和持久性框架之间的区别有点不确定。 ORM 是 PF 的一种吗?您可以期待两者有哪些不同的功能?

I'm reading up on OOP design patterns and framework design and find myself a bit unshure about the difference between the terms ORM and Persistence framework. Is an ORM a type of PF? What are the different features you can expect of the two?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不忘初心 2024-11-04 00:38:11

我将 ORM 定义为将任何数据映射到对象/类结构的系统。该数据可能来自旨在持久数据的系统,但不是强制性的。想象一个 JSON 映射器将数据从网络服务读取到对象中。

持久化框架主要使用 ORM 与用户代码交互并解决问题,使对象的存储尽可能安全可靠。

ORM 是比持久性更通用的术语。 ORM 可以在没有 Persistence 的情况下生存,但反之则不行。

I would define ORM as a system to map any data to the object/class structure. That data may come from a system that is aimed to be for persist data, but not mandatory. Imagine a JSON mapper that reads data from a network service into an object.

A persistence framework mostly uses ORM to interface to user code and covers the problematic to make the storage of objects as secure and reliable as possible.

ORM is more generic term than persistence. ORM may live without Persistence but not vicecersa.

野の 2024-11-04 00:38:11

ORM 指的是对象关系映射的概念,即将数据库中的记录(例如,可能来自表或视图)映射到应用程序(实体)或实体集合及其关系中的对象表示形式。

持久化框架是指将数据持久化(存储)的框架,通常保存到数据库中。请注意,持久性框架可能会持久保存到现实中的任何内容,具体取决于框架,甚至例如 XML 文件。它是数据库和应用程序中的实体之间的抽象层。

有时这些术语可以互换使用。请注意,好的持久性框架有自己的规则,包括如何提取数据、如何持久化数据、如何处理所谓的阻抗不匹配(在 Wiki 中查找)、如何以预定义的方式管理陈旧或脏数据,如何加载数据以及相关数据等等。

ORM refers to the concept of Object Relational Mapping, that is the act of mapping records in a database (which may come from tables or views for example) to their object representation in an application (entity) or collections of entities together with their relationships.

Persistence Frameworks refer to frameworks that persist (store) data , normally into a database. Note that a persistence framework may persist to anything in reality, depending on the framework, even to an XML file for example. It is an abstraction layer between the database and the entities in an application.

Sometimes these terms are used interchangeably. Note that good persistence frameworks have their own rules of how to extract data, how to persist it,how to deal with what is called the impedance mismatch (look it up in Wiki), how to manage stale or dirty data in a predefined way, how to load data and related data, and so on and so forth.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文