Browse Source

BugFix: 如果是 int? 类型, 要判断值!=null 之后, 才能调用ObjToInt扩展方法.

SqlSugar5
yangzhinong 2 years ago
parent
commit
97273d39d6
  1. 5
      Src/Asp.NetCore2/SqlSugar/Infrastructure/ContextMethods.cs

5
Src/Asp.NetCore2/SqlSugar/Infrastructure/ContextMethods.cs

@ -456,7 +456,10 @@ namespace SqlSugar
var addItem = readerValues[info];
if (addItem == DBNull.Value)
addItem = null;
if (UtilMethods.GetUnderType(prop.PropertyType) == UtilConstants.IntType)
if (prop.PropertyType == UtilConstants.IntType )
{
addItem = addItem.ObjToInt();
} else if (UtilMethods.GetUnderType(prop.PropertyType) == UtilConstants.IntType && addItem != null)
{
addItem= addItem.ObjToInt();
}

Loading…
Cancel
Save