public class Employee { [Key, Required] public int Id { get; set; } public int? ManagerId { get; set; } public Employee Manager { get; set; } }
modelBuilder.Entity<Employee>() .HasOptional(r => r.Manager) .WithMany() .HasForeignKey(r => r.ManagerId) .WillCascadeOnDelete(false);
ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.