与核心数据的多对多关系:如何填充交叉数据?

发布于 2024-12-21 19:42:37 字数 230 浏览 1 评论 0原文

我不知道如何使用核心数据来实现以下内容。

员工<<-->>公司

这意味着一名员工可以在不同的公司工作,而一个公司显然可以有很多员工。

但在我的核心数据中,我想存储附加信息,例如“员工 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苍景流年 2024-12-28 19:42:37

如果没有更多地了解您的模型,很难说,但是拥有 PersonEmployeeCompany 实体是否有意义?

Person 可以与 Employee 建立一对多关系,而 EmployeePerson 建立一对一关系。

人<---->>员工

那么 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 and Company?

A Person could have a to-many relationship with Employee while an Employee has a to-one relationship with Person.

Person <---->> Employee

Then an Employee could have a to-one relationship with a Company, and a Company can have a to-many relationship with Employee.

Employee <<----> Company

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 the Employee entity and all the company related information in Company.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文