主键(Primary Key) class Topic { [Column(IsPrimary = true)] public int Id { get; set; } } 约定: 当没有指明主键时,命名为 id 的字段将成为主键:(不区分大小写) 当主键是 Guid 类型时,插入时会自动创建(有序.不重复)的值,所以不需要自己赋值:(支持分布式) 自增(Identity) class Topic { [Column(IsIdentity = true)] public int Id { get
为什么需要字段类型映射? 作为通用型数据引擎的FIREDAC或者UNIDAC,驱动某一种数据库以后,总有一些数据库的一些字段类型,数据引擎不能识别,反应到程序中就是数据引擎不能正确地读取该字段的值 . 如何解决? 那么,此时就会要用到数据引擎的字段类型映射,将源字段类型——不识别的类型,映射成数据引擎能识别的类型. 附FIREDAC字段类型映射的代码: 例如,map TEXT columns to dtAnsiString and INT columns to dtInt64: with AD
//先做基本查询 var querySql = from l in _logClinicDataOperationRepository.Table select new LogClinicDataOperationInfo { LogSeq = l.LogSeq, TypeCode = l.TypeCode, CreateDate = l.CreateDate }; //条件在基本的查询中完成 if (query.CreateDateStart != null) { querySql = que