DateTime16.cs 698 B

123456789101112131415161718192021
  1. using System;
  2. using System.Data;
  3. namespace SqlSugar.BzTDengineCore
  4. {
  5. public class DateTime16 : ISugarDataConverter
  6. {
  7. public SugarParameter ParameterConverter<T>(object columnValue, int columnIndex)
  8. {
  9. var name = "@Common" + columnIndex;
  10. Type undertype = UtilMethods.GetUnderType(typeof(T));//获取没有nullable的枚举类型
  11. return new SugarParameter(name, columnValue, undertype) { CustomDbType = System.Data.DbType.DateTime2 };
  12. }
  13. public T QueryConverter<T>(IDataRecord dr, int i)
  14. {
  15. var value = dr.GetValue(i);
  16. return (T)UtilMethods.ChangeType2(value, typeof(T));
  17. }
  18. }
  19. }