diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MemberExpressionResolve.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MemberExpressionResolve.cs index 555792b3c..508abea56 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MemberExpressionResolve.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MemberExpressionResolve.cs @@ -658,6 +658,16 @@ namespace SqlSugar private static bool IsDateDiff(MemberExpression expression) { + if (expression.Expression != null && + expression.Expression is BinaryExpression) + { + var binExp = (expression.Expression as BinaryExpression); + var nodeType= binExp.NodeType; + if (nodeType == ExpressionType.Subtract&& binExp.Left.Type==UtilConstants.DateType && binExp.Right.Type == UtilConstants.DateType) + { + return true; + } + } return expression.Expression!=null&& expression.Expression is BinaryExpression &&