- 优化 IAdo.Query 方法,当传入带主键特性的实体时,防止主键列为 null 时导致整行记录也为 null;

This commit is contained in:
28810
2020-03-12 00:45:56 +08:00
parent fff7925d22
commit e132133e62
5 changed files with 85 additions and 65 deletions

View File

@ -1495,7 +1495,8 @@ namespace FreeSql.Internal
//判断主键为空,则整个对象不读取
//blockExp.Add(Expression.Assign(readpkvalExp, Expression.Call(rowExp, MethodDataReaderGetValue, dataIndexExp)));
if (trycol?.Attribute.IsPrimary == true)
if (flagStr.StartsWith("adoQuery") == false && //Ado.Query 的时候不作此判断
trycol?.Attribute.IsPrimary == true) //若主键值为 null则整行读取出来的对象为 null
{
ispkExp.Add(
Expression.IfThen(