我一直收到这个错误,我不知道为什么.
类型为’BioSheet.Models.BioSheetModel’的属性’Ward’上的ForeignKeyAttribute无效.在依赖类型“BioSheet.Models.BioSheetModel”上找不到外键名称“WardId”. Name值应该是以逗号分隔的外键属性名称列表.
public class Ward { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } [ForeignKey("AddressId")] [required] public virtual Address WardAddress { get; set; } [ForeignKey("BioSheetId")] public virtual List<BioSheetModel> BioSheets { get; set; } [required] public String Code { get; set; } } public class BioSheetModel { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } [required] public String FirstName { get; set; } [required] public String LastName { get; set; } public String Email { get; set; } [ForeignKey("WardId")] [required] public Ward Ward { get; set; } public String CellPhoneNumber { get; set; } public String HouseNumber { get; set; } [required] public String DoB { get; set; } [required] public Address Address { get; set; } public String OtherInformation { get; set; } public String PrevIoUsCallings { get; set; } [ForeignKey("TimePeriodId")] public virtual TimePeriod TimePeriods { get; set; } public String HomeWard { get; set; } public Boolean OkToText { get; set; } [DatabaseGenerated(DatabaseGeneratedOption.Identity)] [required] public DateTime TodaysDate { get; set; } [ForeignKey("EMPId")] public virtual EDUEMP EduEmp { get; set; } [ForeignKey("SingId")] public virtual Sing Singing { get; set; } [ForeignKey("MissionId")] public virtual Mission MissionIn { get; set; } }
谁能帮我解决这个问题?