public partial class User
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public User()
{
this.KindleEmails = new HashSet<KindleEmail>();
}
public int userId { get; set; }
public string fullName { get; set; }
public string password { get; set; }
public string email { get; set; }
public Nullable<System.DateTime> createDate { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<KindleEmail> KindleEmails { get; set; }
}
这段代码是VS2017自动生成的,但是我不太明白的是 数据库表中1对多的关系在C#中是如何实现的?在实际应用中,应该如何去实现?