mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-21 02:58:05 +08:00
-
This commit is contained in:
@@ -51,6 +51,7 @@ namespace SqlSugar
|
|||||||
private static readonly MethodInfo getInt64 = typeof(IDataRecord).GetMethod("GetInt64", new Type[] { typeof(int) });
|
private static readonly MethodInfo getInt64 = typeof(IDataRecord).GetMethod("GetInt64", new Type[] { typeof(int) });
|
||||||
private static readonly MethodInfo getString = typeof(IDataRecord).GetMethod("GetString", new Type[] { typeof(int) });
|
private static readonly MethodInfo getString = typeof(IDataRecord).GetMethod("GetString", new Type[] { typeof(int) });
|
||||||
private static readonly MethodInfo getEnum = typeof(IDataRecordExtensions).GetMethod("GetEnum");
|
private static readonly MethodInfo getEnum = typeof(IDataRecordExtensions).GetMethod("GetEnum");
|
||||||
|
private static readonly MethodInfo getConvertString = typeof(IDataRecordExtensions).GetMethod("GetConvertString");
|
||||||
private static readonly MethodInfo getConvertFloat = typeof(IDataRecordExtensions).GetMethod("GetConvertFloat");
|
private static readonly MethodInfo getConvertFloat = typeof(IDataRecordExtensions).GetMethod("GetConvertFloat");
|
||||||
private static readonly MethodInfo getConvertBoolean = typeof(IDataRecordExtensions).GetMethod("GetConvertBoolean");
|
private static readonly MethodInfo getConvertBoolean = typeof(IDataRecordExtensions).GetMethod("GetConvertBoolean");
|
||||||
private static readonly MethodInfo getConvertByte = typeof(IDataRecordExtensions).GetMethod("GetConvertByte");
|
private static readonly MethodInfo getConvertByte = typeof(IDataRecordExtensions).GetMethod("GetConvertByte");
|
||||||
@@ -216,7 +217,7 @@ namespace SqlSugar
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (method == null&&bindPropertyType == PubConst.StringType) {
|
if (method == null&&bindPropertyType == PubConst.StringType) {
|
||||||
method = getString;
|
method = getConvertString;
|
||||||
}
|
}
|
||||||
if (method == null)
|
if (method == null)
|
||||||
method = getOtherNull.MakeGenericMethod(bindPropertyType);
|
method = getOtherNull.MakeGenericMethod(bindPropertyType);
|
||||||
|
@@ -118,6 +118,16 @@ namespace SqlSugar
|
|||||||
return reval;
|
return reval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetConvertString(this IDataRecord dr, int i)
|
||||||
|
{
|
||||||
|
if (dr.IsDBNull(i))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var reval =Convert.ToString(dr.GetValue(i));
|
||||||
|
return reval;
|
||||||
|
}
|
||||||
|
|
||||||
public static Nullable<T> GetOtherNull<T>(this IDataReader dr, int i) where T : struct
|
public static Nullable<T> GetOtherNull<T>(this IDataReader dr, int i) where T : struct
|
||||||
{
|
{
|
||||||
if (dr.IsDBNull(i))
|
if (dr.IsDBNull(i))
|
||||||
|
Reference in New Issue
Block a user