Browse Source

Special handling of drivers that cannot be resolved

pull/12/MERGE
skx 4 years ago
parent
commit
3a5d8fa605
  1. 4
      Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataReaderEntityBuilder.cs
  2. 11
      Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs

4
Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataReaderEntityBuilder.cs

@ -217,6 +217,10 @@ namespace SqlSugar
{
method = isNullableType ? getConvertByte : getByte;
}
else if (bindPropertyType == UtilConstants.StringType&&dbTypeName?.ToLower()== "timestamp")
{
method = getConvertValueMethod.MakeGenericMethod(columnInfo.PropertyInfo.PropertyType); ;
}
else if (bindPropertyType == UtilConstants.StringType)
{
method = getString;

11
Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs

@ -137,6 +137,8 @@ namespace SqlSugar
return result;
}
public static T GetConvertValue<T>(this IDataRecord dr, int i)
{
try
{
if (dr.IsDBNull(i))
{
@ -145,6 +147,15 @@ namespace SqlSugar
var result = dr.GetValue(i);
return UtilMethods.To<T>(result);
}
catch (Exception ex)
{
if (dr.GetFieldType(i) == UtilConstants.DateType)
{
return UtilMethods.To<T>(dr.GetConvertDouble(i));
}
throw new Exception(ex.Message);
}
}
public static long? GetConvetInt64(this IDataRecord dr, int i)
{

Loading…
Cancel
Save