ER diagram - Project, Task and Employee

只愿长相守 提交于 2020-01-14 06:03:30

问题


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.

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

If this ER diagram looks incorrect, please recommend revisions.


回答1:


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

Your ER model doesn't enforce that.

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).


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

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).




回答2:


  • currently you don't have the information which employee is assigned to which project
  • the relations look like employee / task is an m:n relationship, i think you didn't do that on purpose
  • is employeetasks inherited from task or is it the relationship entity?


来源:https://stackoverflow.com/questions/11656150/er-diagram-project-task-and-employee

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!