ER图 - 项目,任务和员工 [英] ER diagram - Project, Task and Employee

查看:2189
本文介绍了ER图 - 项目,任务和员工的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新:
公司可以有多个项目,公司也有员工。员工只能有一个公司,一个项目也只能有一家公司。

一个项目有几个任务。
在这些任务中,员工只能被分配到某些任务。

UPDATE: Company can have multiple Projects and Company also have Employees. An employee can only have one Company and a Project can also have only one company. A project has several tasks. Out of these tasks, an Employee will only be assigned to some of the tasks.

员工只能为项目分配任务,他/她是分配给。

The employee can only be assigned tasks for project that he/she is assigned to.

请查看以下内容,并帮助我如何创建数据库设计和最终实体模型
更新图基于两个评论:
如果这个ER图看起来不错,可以提供如何创建EF 4.1实体类的指导,尤其是对于EmployeeProjectTasks表。 我是EF 4.1 Code First的新手,想要创建这些课程的方向

Please review the following and help on how I should create the database design and the final entity model UPDATED DIAGRAM based on the two comments: If this ER diagram looks good, could you please provide guidance on how the EF 4.1 entity classes should be created, especially for EmployeeProjectTasks table. I am new to EF 4.1 Code First and would like some direction with creating these classes

如果此ER图看起来不正确,请推荐修订。

If this ER diagram looks incorrect, please recommend revisions.

推荐答案


员工只能为他/她分配到的项目分配任务。

The employee can only be assigned tasks for project that he/she is assigned to.

您的ER模型不执行此操作。

Your ER model doesn't enforce that.

这是因为 Project Task ,所以在$ {code> EmployeeProjectTask.ProjectID ProjectID 的传播c>仅引用 EmployeeProject (但不是任务)。

That's because of the non-identifying relationship between Project and Task, so the propagation of ProjectID is cut-off in that branch of the diamond-shaped dependency and EmployeeProjectTask.ProjectID only references EmployeeProject (but not Task).

确保 EmployeeProjectTask 的模型与 EmployeeProject 任务相同的 项目将如下所示:

The model that ensures EmployeeProjectTask is connected with EmployeeProject and Task from the same Project would look like this:

注意任务是否具有复合PK {ProjectID,TaskNo} 以及项目.ProjectID 沿着钻石底部的分支和合并进行传播(导致 EmployeeProjectTask.ProjectID ,FK都包含 EmployeeProject Task )。

Note how Task has a composite PK {ProjectID, TaskNo}, and how Project.ProjectID is propagated down both "branches", and merged at the bottom of the "diamond" (resulting in the EmployeeProjectTask.ProjectID, with FK to both EmployeeProject and Task).

这篇关于ER图 - 项目,任务和员工的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆