申請者に通知があり、通知に申請者があります。 EFの1対1の関係、プロパティを設定することができません
私は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; }
誤差が第2のテーブル定義にForeignKeyAttribute
注釈が存在しないことに由来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