diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/Query/SingleQuery.cs b/Src/Asp.Net/SqlServerTest/UnitTest/Query/SingleQuery.cs index 7d1c4d65b..c06102a0c 100644 --- a/Src/Asp.Net/SqlServerTest/UnitTest/Query/SingleQuery.cs +++ b/Src/Asp.Net/SqlServerTest/UnitTest/Query/SingleQuery.cs @@ -124,6 +124,14 @@ namespace OrmTest.UnitTest new SugarParameter("@Id0",1), new SugarParameter("@Const1",1) }, t13.Key, t13.Value, "single t13 error "); + + + var t14 = db.Queryable() + .Where(it => it.Name == "a" && SqlFunc.HasValue(it.Name)).ToSql(); + base.Check("SELECT [ID],[SchoolId],[Name],[CreateTime] FROM [STudent] WHERE (( [Name] = @Name0 ) AND ( [Name]<>'' AND [Name] IS NOT NULL ))", + new List() { + new SugarParameter("@Name0","a") + }, t14.Key, t14.Value, "single t14 error "); } } } diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs index 5fba25a20..fd30e7c6c 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs @@ -209,7 +209,7 @@ namespace SqlSugar model.Args.AddRange(appendArgs); } var methodValue = GetMdthodValue(name, model); - if (parameter.BaseExpression is BinaryExpression && parameter.OppsiteExpression.Type == UtilConstants.BoolType&&name=="HasValue") { + if (parameter.BaseExpression is BinaryExpression && parameter.OppsiteExpression.Type == UtilConstants.BoolType&&name=="HasValue"&&!(parameter.OppsiteExpression is BinaryExpression)) { methodValue = this.Context.DbMehtods.CaseWhen(new List>() { new KeyValuePair("IF",methodValue.ObjToString()), new KeyValuePair("Return","1"), diff --git a/Src/Asp.Net/SqlSugar/Properties/AssemblyInfo.cs b/Src/Asp.Net/SqlSugar/Properties/AssemblyInfo.cs index 1c2875fa2..971196ddb 100644 --- a/Src/Asp.Net/SqlSugar/Properties/AssemblyInfo.cs +++ b/Src/Asp.Net/SqlSugar/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("4.6.0.5")] -[assembly: AssemblyFileVersion("4.6.0.5")] +[assembly: AssemblyVersion("4.6.0.6")] +[assembly: AssemblyFileVersion("4.6.0.6")]