本文介绍了获取属性v关系(核心数据 - iPhone)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个新的iPhone开发者(大约4个月左右),开始查看Core Data。

I'm a new iPhone developer (of about 4 months or so) who is starting to look at Core Data.

在Dave Mark的开始iPhone 3开发书中提到,获取的属性之间的并且关系是获取的属性允许延迟加载。但是,我已经看到了其他资源和在这个网站上接受的答案,表明关系允许延迟加载。

In the "Beginning iPhone 3 Development" book by Dave Mark it mentions that the main difference between fetched properties and relationships is that fetched properties allow lazy loading. However, I have seen other resources and accepted answers on this site which suggest that relationships do allow lazy loading.

例如,如果我有一个Department对象,很多与员工的关系,那么我不想在给定的部门抓取所有相关的员工加载到内存中。

For example, if I have a Department object with a to-many relationship with Employee then I would not want a fetch on a given Department to load all the associated employees into memory.

我非常感谢这个权威的答案点和其他差异,因为它对任何设计有明显的影响。

I would be extremely grateful for an authoritative answer on this point, and on the other differences, as it has obvious implications on any design.

此外,如果有人可以指向一个合理的核心数据资源,我将非常感谢这是一个清晰和初学者友好的指南(我以前是一个Java开发人员,但我是新的iPhone-Way ...

Also, I would be extremely grateful if someone could point me towards a reasonable Core Data resource that is a clear and beginner friendly guide (I have been a Java Developer previously but I am new to the iPhone-Way...

推荐答案

查看 in Core Data:

Check out faulting in Core Data:

使用故障,如果从永久性存储检索单个Employee对象,其管理器,部门和报表关系最初由故障表示。虽然故障是Department类的一个实例,但尚未实现 - 它的持久化实例变量尚未设置。

>如果您向Department对象发送一条消息来获取它的名称,那么故障就会触发 - 在这种情况下,Core Data会执行一次抓取,以检索所有对象的属性。

If you send the Department object a message to get, say, its name, then the fault fires—and in this situation Core Data executes a fetch for you to retrieve all the object's attributes.

这篇关于获取属性v关系(核心数据 - iPhone)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 07:31