DbEntry 默认 主键ID为long
DbEntry 默认 主键ID为long,如果自己表中的主键ID为int,可以通过以下方式修改:
1 public class Company :DbObjectModel<Company,int> 2 { 3 public string CompanyName { get; set; } 4 public string CompanyID { get; set; } 5 public int CompanyType { get; set; } 6 }
给DbObjectMode传个int进去
DbObjectMode源码:
1 namespace Lephone.Data.Definition 2 { 3 [Serializable] 4 public class DbObjectModel<T, TKey> : DbObjectModelBase<T, TKey> 5 where T : global::Lephone.Data.Definition.DbObjectModel<T, TKey>, new() 6 where TKey : struct 7 { 8 public DbObjectModel(); 9 10 [DbKey] 11 public TKey Id { get; set; } 12 } 13 }