Core data 核心数据-与不同实体的关系
假设我有以下数据模型:Core data 核心数据-与不同实体的关系,core-data,entity-relationship,Core Data,Entity Relationship,假设我有以下数据模型: Entity Person Attribute name String Attribute personType String Attribute dailyRecords Entity CarpenterDailyRecord Attribute numberOfNailsHammered Int Attribute picNameOfFinishedCabinet String Entity WindowWasherDailyRecord Attribute na
Entity Person
Attribute name String
Attribute personType String
Attribute dailyRecords
Entity CarpenterDailyRecord
Attribute numberOfNailsHammered Int
Attribute picNameOfFinishedCabinet String
Entity WindowWasherDailyRecord
Attribute nameOfBuildingWashed String
Attribute numberOfWindowsWashed Int
我想在Person.dailyRecords和1个每日记录实体之间建立一种多对多的关系,这些实体根据人员类型而变化。当然,我可以创建一个CarpenterPerson和windowsweater实体,每个实体都指向它独特的每日记录结构,但我必须在我的应用程序中将人们分组
因此,如果我做一个集团实体:
实体组
属性人物数组
我还是被卡住了。如何指向多个不同的个人实体
肯定有一个明显的答案,只是我对这一切都很陌生。谢谢 创建处理关系Person>DailyRecord的父DailyRecord实体。[CarpenterDailyRecord | WindowWasherDailyRecord]然后继承DailyRecord
但是,这样做的风险在于,WindowWasherDailyRecord、CarpenterDailyRecord的所有子项都将位于基础sqlite结构的一个表中,因此可能会对性能造成影响。这不是避免继承的理由,只是设计数据模型时需要注意的事项。谢谢Marcus。不同记录类型中表示的数据可能有足够的重叠,这样核心数据就不必创建太多的唯一列。我得调查一下。我假设DailyRecord实体可以是抽象的?我将进一步阅读这个话题,但我想我已经掌握了要点。再次感谢!是的,很抱歉不清楚,DailyRecord实体将是抽象的。顺便说一句,不要忘记接受你认为正确的答案。