【发布时间】:2017-06-06 23:10:19
【问题描述】:
一个申请人有一个通知,一个通知有一个申请人。
我正在尝试在 EF 中实现此功能,但收到以下错误:
"属性 'ApplicantID' 不能配置为导航 财产。该属性必须是有效的实体类型,并且该属性 应该有一个非抽象的 getter 和 setter。供收藏 类型必须实现 ICollection 的属性,其中 T 是有效的 实体类型。”
不确定,我做错了什么。
申请人
[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; }
申请人通知
[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; }
【问题讨论】:
标签: c# entity-framework