diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs index 139dd57d2..34d0b02ca 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs @@ -380,6 +380,11 @@ namespace SqlSugar { Expression trueValue = Expression.Constant(true); var newItem = ExpressionBuilderHelper.CreateExpression(item, trueValue, ExpressionType.And); + var member = (item as MemberExpression); + if (member.Member.Name == "HasValue") + { + newItem = ExpressionBuilderHelper.CreateExpression(member.Expression, Expression.Constant(null), ExpressionType.And); + } AppendItem(parameter, name, new List() { newItem}, model, newItem); } else