1


I just want to confirm whether this is a good approach to model an entity as bellow and what are the basics rules that it brakes? By doing so do I need to do anything OnModelCreating?

Usecase: There are two types of users. One is Manger, the other one is the Marketing Officer. Then the Manager wants to create his team.

So I have modeled it as follows.

User and Role entities

public class User { 
    public int Id {get; set;} 
    public string UserName {get; set;} 
    public virtual Role Designation  {get; set;} 
}

public class Role { 
    public int Id {get; set;}
    public string RoleName {get; set;}
}

Then composed the Team entity.

public class Team { 
    public int Id {get; set;} 
    public int ManagerId {get; set;} 
    public virtual User Manager {get; set;} 

    public virtual ICollection<User> MarketingOfficers  {get; set;} 
}
Pubudu
  • 61
  • 7

0 Answers0