I have two tables called employee and team. I want to set relationships among the tables as follows.
employee belongs to a team. (1: m relationship).
team has a team leader (team leader is also an employee). (1:1 relationship)
employee table
[primary key]
public int RegistrationNumber { get; set; }
public string Name { get; set; }
public string Email { get; set; }team table
[primary key]
public string Name { get; set; }
public string Description { get; set; }
How can I do it?
Below is a work demo, you can refer to it.
team.cs:
employee.cs:
TeamLeaderDbContext:
homecontroller:
result: