与核心数据的多对多关系:如何填充交叉数据?
我不知道如何使用核心数据来实现以下内容。
员工<<-->>公司
这意味着一名员工可以在不同的公司工作,而一个公司显然可以有很多员工。
但在我的核心数据中,我想存储附加信息,例如“员工 ID”或“资历级别”。这些数据与实体之间的关系相关联。 通常这些数据存储在交集表中,但是核心数据呢?
预先感谢,亚萨
I have no idea how to implement the following using Core Data.
employee <<-->> company
This means that an employee can work in different companies, and one company can obviously have many employees.
But in my core data, I want to store additional information, like "employee id" or "level of seniority". These data are linked to the relationship between the entities.
Normally these data are stored in intersection tables, but what with core data?
Thanks in advance, yassa
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果没有更多地了解您的模型,很难说,但是拥有
Person
、Employee
和Company
实体是否有意义?Person
可以与Employee
建立一对多关系,而Employee
与Person
建立一对一关系。那么
Employee
可以与Company
建立一对一关系,Company
可以与建立一对多关系员工。
现在,您可以在
Person
中存储与任何特定公司的雇佣无关的个人详细信息,在Employee
中保留员工详细信息,例如“ID”或“资历” code> 实体以及Company
中的所有公司相关信息。Hard to say without seeing more of your model, but would it make sense to have entities for
Person
,Employee
andCompany
?A
Person
could have a to-many relationship withEmployee
while anEmployee
has a to-one relationship withPerson
.Then an
Employee
could have a to-one relationship with aCompany
, and aCompany
can have a to-many relationship withEmployee
.Now you can store the personal details that aren't related to employment to any specific company in
Person
, keep the employee details such as "ID" or "seniority" in theEmployee
entity and all the company related information inCompany
.