mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 12:28:15 +08:00
- 修复 OracleOledb 引起的读取类型问题;
- 调整 DynamicEntity API;#1505
This commit is contained in:
@ -342,6 +342,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
[typeof(string)] = typeof(DbDataReader).GetMethod("GetString", new Type[] { typeof(int) }),
|
||||
//[typeof(Guid)] = typeof(DbDataReader).GetMethod("GetGuid", new Type[] { typeof(int) }) 有些驱动不兼容
|
||||
};
|
||||
public static Dictionary<DataType, Dictionary<Type, MethodInfo>> _dicMethodDataReaderGetValueOverride = new Dictionary<DataType, Dictionary<Type, MethodInfo>>();
|
||||
|
||||
public static MethodInfo MethodStringContains = typeof(string).GetMethod("Contains", new[] { typeof(string) });
|
||||
public static MethodInfo MethodStringStartsWith = typeof(string).GetMethod("StartsWith", new[] { typeof(string) });
|
||||
|
@ -744,8 +744,11 @@ namespace FreeSql.Internal.CommonProvider
|
||||
_orm.Aop.AuditDataReaderHandler == null &&
|
||||
_dicMethodDataReaderGetValue.TryGetValue(col.Attribute.MapType.NullableTypeOrThis(), out var drGetValueMethod))
|
||||
{
|
||||
if (_dicMethodDataReaderGetValueOverride.TryGetValue(_orm.Ado.DataType, out var drDictOverride) && drDictOverride.TryGetValue(col.Attribute.MapType.NullableTypeOrThis(), out var drDictOverrideGetValueMethod))
|
||||
drGetValueMethod = drDictOverrideGetValueMethod;
|
||||
|
||||
Expression drvalExp = Expression.Call(rowExp, drGetValueMethod, Expression.Constant(colidx));
|
||||
if (col.CsType.IsNullableType()) drvalExp = Expression.Convert(drvalExp, col.CsType);
|
||||
if (col.CsType.IsNullableType() || drGetValueMethod.ReturnType != col.CsType) drvalExp = Expression.Convert(drvalExp, col.CsType);
|
||||
drvalExp = Expression.Condition(Expression.Call(rowExp, _MethodDataReaderIsDBNull, Expression.Constant(colidx)), Expression.Default(col.CsType), drvalExp);
|
||||
|
||||
if (drvalType.IsArray || drvalType.IsEnum || Utils.dicExecuteArrayRowReadClassOrTuple.ContainsKey(drvalType))
|
||||
|
Reference in New Issue
Block a user