gpt4 book ai didi

objective-c - 核心数据 : Traverse managed objects relationships with an abstract entity in-between

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

我有以下核心数据模型,其中 ProFormaPeriod抽象实体 FiscalPeriod 的子类。在我的获取请求中,我想从 CalendarPeriod 遍历到 IBEstType

我该怎么做,因为 fiscalPeriod 是我在代码完成中获得的唯一关系,而不是 ProformaPeriod

我是否需要对从 CalendarPeriodProformaPeriod 的其他直接关系建模?

enter image description here

最佳答案

一种方法是获取 FiscalPeriod 并遍历结果以检查正确的类并过滤出正确的 IBEstType(s)。与谓词中的直接键路径相比,它应该仍然非常有效,具体取决于数据的大小。

否则,是的,您必须使子实体成为直接关系。

检查类:

for (NSManagedObject *obj in fetchedFiscalPeriods) { 
if ([obj isKindOfClass:[ProformaPeriod class]]) {
ProformaPeriod *period = (ProformaPeriod*) obj;
// check period.estimateType
}
}

关于objective-c - 核心数据 : Traverse managed objects relationships with an abstract entity in-between,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13197263/

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