This is my entity:
public class User {
public int Id { get; set; }
public string Name { get; set; }
public int? ManagerId { get; set; }
public User Manager { get; set; }
}
I have relation on same table with ManagerId
.
builder.HasOne(t => t.Manager).WithMany();
I'm using entity framework core and i want to iterate over all child by id.
Example:
Id | Name | ManagerId
---------------------
1 | Boss | null
---------------------
2 | Child1 | 1
---------------------
3 | Child2 | 2
Input: 1
Output: 2, 3
Input: 2
Output: 3
P.S. There can be more than one "Bosses" so i want to filter by id