[ForeignKey("WardId")]
indicates that the property used as the foreign key for the Ward table should be the WardId
property in the BioSheetModel
class.
You get an error because you did not define the WardId
property in the BioSheetModel
class.
Add
public int WardId {get; set;}
for a relationship with a zero / mandatory relationship or
public int? WardId {get; set;}
for a relationship with null / optional.
source share