Note that there are some explanatory texts on larger screens.

plurals
  1. POEntity Framework Code First create db from models
    primarykey
    data
    text
    <p>I am trying to use entity framework to build the database and I need some help with the models:</p> <p>The models are: Company, Departments, Users, TaskType1, TaskType2, TaskType3</p> <pre><code>public class Company { public Company() { this.Departments = new HashSet&lt;Department&gt;(); } public int Id { get; set;} public string CompanyName { get; set;} public string Address { get; set;} public string Phone { get; set;} public virtual ICollection&lt;Department&gt; Departments { get; set;} } public class Department { public Department() { this.Users = new HashSet&lt;User&gt;(); } public int Id { get; set;} public string Name { get; set;} public virtual Company Company { get; set;} public virtual ICollection&lt;User&gt; Users { get; set;} } public class User { public Company() { } public int Id { get; set;} public string UserName { get; set;} public string FullName { get; set;} public virtual Department Department { get; set;} } public class TaskType1 { public TaskType1() { } public int Id { get; set;} public string Name { get; set;} public string Description { get; set;} public int Priority { get; set;} } public class TaskType2 { public TaskType2() { } public int Id { get; set;} public string Name { get; set;} public string Description { get; set;} public int Priority { get; set;} public double EstimatedCosts { get; set;} } public class TaskType3 { public TaskType3() { } public int Id { get; set;} public string Name { get; set;} public string Description { get; set;} public int Priority { get; set;} public bool IsDone { get; set;} } </code></pre> <p>the reason I need to have TaskType1, TaskType2, TaskType3 as tables is because there are different types of tasks (different data/fields is needed). </p> <p>How can I connect my task types to the Company and to the Department and Users so I can get results like:</p> <ul> <li>all tasks per company X</li> <li>all tasks assigned to department z from company x</li> <li>all tasks assigned to user w from department z from company x</li> </ul> <p>P.S. The task types have common and different columns</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload