I keep getting this error and I do not know why.
The ForeignKeyAttribute on property \'Ward\' on type \'BioSheet.Models.BioSheetModel\' is not valid. The foreign key
[ForeignKey("WardId")]
indicates that the property to use as a foreign key to the Ward table should be the WardId
property on the BioSheetModel
class.
You're getting the error because you haven't defined a WardId
property on the BioSheetModel
class.
Add
public int WardId {get; set;}
for a non-nullable/required relationship, or
public int? WardId {get; set;}
for a nullable/optional relationship.