C#C
C#3y ago
Anu6is

Entity Framework Core One-to-One Relationship => Introducing FOREIGN KEY constraint

public class Employee
    {
        [Required]
        public int EmployeeId { get; set; }
        public string FirstName { get; set; }
        public EmployeePosition EmployeePosition { get; set; }
        [ForeignKey("ShopId")]
        public int ShopId { get; set; }
        public Shop Shop { get; set; }
        public int TaskEmployeeeId { get; set; }
        public TaskEmployee TaskEmployee { get; set; }
    }

why are you adding a foreign key to the shop here?
Was this page helpful?