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 }

 

相关文章:

  • 2021-09-01
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
  • 2021-10-03
  • 2021-08-27
  • 2021-12-10
猜你喜欢
  • 2021-08-30
  • 2022-01-17
  • 2021-08-04
  • 2021-07-04
  • 2022-12-23
  • 2021-07-12
相关资源
相似解决方案