mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-18 09:44:39 +08:00
Synchronization code
This commit is contained in:
@@ -63,8 +63,14 @@ namespace SqlSugar.DbConvert
|
||||
public T QueryConverter<T>(IDataRecord dr, int i)
|
||||
{
|
||||
|
||||
|
||||
var value = dr.GetValue(i);
|
||||
if (value is byte[] && typeof(T) != UtilConstants.ByteArrayType)
|
||||
{
|
||||
value = Encoding.UTF8.GetString((byte[])value);
|
||||
}
|
||||
return (T)UtilMethods.ChangeType2(value, typeof(T));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -750,6 +750,10 @@ namespace SqlSugar
|
||||
}
|
||||
public static object ChangeType2(object value, Type type)
|
||||
{
|
||||
if (value is byte[]&&type==UtilConstants.StringType)
|
||||
{
|
||||
return Encoding.UTF8.GetString(value as byte[]);
|
||||
}
|
||||
if (value == null && type.IsGenericType) return Activator.CreateInstance(type);
|
||||
if (value == null) return null;
|
||||
if (type == value.GetType()) return value;
|
||||
|
Reference in New Issue
Block a user