我有一些从数据库生成的数据类:
[Table("appdb.apptable")]
public partial class apptable
{
[Key]
public int Id { get; set; }
public int Sum { get; set; }
public string Comment { get; set; }
}
怎么样,我需要以通用的方式支持不同的表。表名相同,但不包含 Comment 字段。我需要以某种方式使 Comment 属性成为可选的。
如何在实体框架中使现有的数据库字段可选?