开发者

Multiple Relationship In Core Data to Entities of the Same Type

Say I have a business class

Business class has 3 relationships

menus are menus brochures are brochures images are images

They are all related to an image entity. Image entity has a business relationship which points to the business owning the menus, brochures, and images respectively.

What would be the inverse relationship of the business relationshi开发者_开发知识库p then? Menus? Brochures? or Images?


I think each relationship needs its own inverse, for data integrity reasons. So if you have menus, brochures and images, you need three inverses: businessForMenu, businessForBrochure, businessForImage.

If you need to be able to access the aggregate of those three things, you could then model the business relationship from image as a fetched property, selecting on Business, with the predicate

ANY menus == "$FETCH_SOURCE" OR ANY brochures == "$FETCH_SOURCE" OR ANY images == "$FETCH_SOURCE"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜