如何将列指定为唯一的数据库标识,但它不是由数据库生成的?如果REPORT_ID是数据库生成的话,我通常会这样做:
[Table("[Report.Settings]")]
public partial class Report_Settings
{
[Key]
[Column(Order = 0)]
public int INSTANCE_ID { get; set; }
[Key]
[Column(Order = 1)]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long REPORT_ID { get; set; }
public string REPORT_METADATA { get; set; }
public string REPORT_GRID_SETTINGS { get; set; }
public virtual Report Report { get; set; }
}