私はクラスJobDescription
と を持っている状況がありImage
ます。1対0または多数の関係を確立したい。JobDescriptionが存在する場合は、画像のコレクションがあるか、画像がまったくない可能性があります。同じことがImageとImageSectionにも当てはまります。私のクラスで私は正しくやっていますか?
public class JobDescription
{
public int JobDescriptionID { get; set; }
// Other attributes and navigations
public int? ImageID { get; set; }
[ForeignKey("ImageID")]
public virtual List<Image> Image { get; set; }
}
public class Image
{
public int ImageID { get; set; }
public string ImageName { get; set; }
public int? ImageSectionID { get; set; }
[ForeignKey("ImageSectionID")]
public virtual ImageSection ImageSection { get; set; }
}