0
InteractivePartners created
I am creating an employee table using power tools, and I am trying to add a self referencing relation on the table. Table structure public class Employee { public int EmployeeId { get; set; } public string Name { get; set; } // Self-Referential Relationship public int? ManagerId { get; set; } public Employee Manager { get; set; } }
Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)
1 Answer(s)
-
0
Hi @InteractivePartners
After creating the Employee entity, open
"Regenerate Entity"in Power Tools. Then, navigate to the"Navigation Properties"tab and click"Add New Navigation Property."Select the Employee entity to establish a self-referencing relationship.An entity similar to the relationship below will be created.
public class Employee : Entity { public virtual string Name { get; set; } public virtual int? EmployeeId { get; set; } [ForeignKey("EmployeeId")] public Employee EmployeeFk { get; set; } }Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)