Update Core

This commit is contained in:
skx
2020-11-02 11:09:26 +08:00
parent 3a5d8fa605
commit f765812663
2 changed files with 19 additions and 4 deletions

View File

@@ -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;

View File

@@ -138,12 +138,23 @@ namespace SqlSugar
}
public static T GetConvertValue<T>(this IDataRecord dr, int i)
{
if (dr.IsDBNull(i))
try
{
return default(T);
if (dr.IsDBNull(i))
{
return default(T);
}
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);
}
var result = dr.GetValue(i);
return UtilMethods.To<T>(result);
}
public static long? GetConvetInt64(this IDataRecord dr, int i)