gpt4 book ai didi

iphone - 为什么 NSManagedObject 和 NSEntityDescription 是单独的类?

转载 作者:行者123 更新时间:2023-12-03 16:11:06 25 4
gpt4 key购买 nike

似乎 NSEntityDescription 对象描述数据,而 NSManagedObject 对象包含相应的数据。如果您有一个普通的 NSObject 子类,那么数据的描述和实际数据位于同一位置,不是吗?好吧,至少描述在类中,数据在对象中。您可以将对象视为具有对其所包含变量类型的描述。

为什么 Core Data 将描述数据的类和包含数据的类分开呢?与错误有关吗?

最佳答案

If you have a normal NSObject subclass, the description of the data and the actual data are in the same place, aren't they.

没有。类是对象的描述,实例是对象(包括其数据。

Why then does Core Data separate the class which describes the data and the class which contains the data? Is it to do with faulting?

不,这是因为模型的描述与符合模型的数据的实例化本质上是不同的。这是计算中的标准事物,例如对于 SQL 数据库,数据的描述(DDL)不是数据(实际的数据库)。对于 XML,描述(架构或 DTD)不是实际的 XML 数据。

关于iphone - 为什么 NSManagedObject 和 NSEntityDescription 是单独的类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5483003/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com