申請人有通知,通知有申請人。EF一對一關係,無法配置房產
我想在EF來實現這一點,但我收到以下錯誤:
"The property 'ApplicantID' cannot be configured as a navigation property. The property must be a valid entity type and the property should have a non-abstract getter and setter. For collection properties the type must implement ICollection where T is a valid entity type."
不知道,我在做什麼錯。
申請人
[Index]
[Key]
public int ApplicantID { get; set; }
public string ApplicantTitle { get; set; }
public string Firstname { get; set; }
public string Lastname { get; set; }
public string Address { get; set; }
public string Address1 { get; set; }
public string Address2 { get; set; }
public string Address3 { get; set; }
public string Postcode { get; set; }
//fk
public int ApplicantNotificationID { get; set; }
public ApplicantNotification Notification { get; set; }
ApplicantNotification
[Index]
public int ApplicantNotificationID { get; set; }
public bool FirstNotification { get; set; }
public bool SecondtNotification { get; set; }
public bool ThirdNotification { get; set; }
public bool FinalNotification { get; set; }
public DateTime ReminderDate { get; set; }
public int ReminderFrequency { get; set; }
[DataType(DataType.Date)]
public DateTime FirstNotificationDate { get; set; }
[DataType(DataType.Date)]
public DateTime SecondNotificationDate { get; set; }
[DataType(DataType.Date)]
public DateTime ThirdNotificationDate { get; set; }
public bool IsArchive { get; set; }
//FK
public int ApplicantID { get; set; }
//navigation property
public Applicant Applicant { get; set; }
我的第一種方法確實對ApplicantID的FK屬性,但沒有工作,並重復同樣的錯誤。然而這是個詭計,很奇怪 – Haris