Here is my two model and i am getting this error on asp.net mvc5 codefirst when Update-Database
ERROR : Unable to determine the principal end of an association between the types 'ModulericaV1.Areas.Hr.Models.HrDepartment' and 'ModulericaV1.Areas.Hr.Models.HrPerson'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations.
DEPARTMENT
public class HrDepartment
{
[Key]
public int Id { get; set; }
[Display(Name = "Departman Adı")]
public string Name { get; set; }
public int? HrDepartmentId { get; set; }
[ForeignKey("HrDepartmentId")]
public virtual HrDepartment RelatedDepartment { get; set; }
public int HrPersonId { get; set; }
public virtual HrPerson HrPerson { get; set; }
}
PERSON
public class HrPerson
{
public int Id { get; set; }
[Display(Name = "Ad")]
public string Name { get; set; }
[Display(Name = "Departman")]
public int HrDepartmentId { get; set; }
public virtual HrDepartment HrDepartment { get; set; }
}