mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-27 11:19:15 +08:00
Optimized expression
This commit is contained in:
@@ -99,6 +99,13 @@ namespace OrmTest.UnitTest
|
||||
new List<SugarParameter>() {
|
||||
new SugarParameter("@Const0",result.Value.Date)
|
||||
}, t5.Key, t5.Value, "select t5 Error");
|
||||
db.Ado.IsEnableLogEvent = false;
|
||||
|
||||
var t6 = db.Queryable<DataTestInfo2>().Where(it => SqlFunc.HasValue(it.Bool2) == false).ToSql();
|
||||
base.Check("SELECT [PK],[Bool1],[Bool2],[Text1] FROM [DataTestInfo2] WHERE (( CASE WHEN ( [Bool2]<>'' AND [Bool2] IS NOT NULL ) THEN 1 ELSE 0 END ) = @Const0 )",
|
||||
new List<SugarParameter>() {
|
||||
new SugarParameter("@Const0",false)
|
||||
}, t6.Key, t6.Value, "select t6 Error");
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
@@ -197,6 +197,13 @@ namespace SqlSugar
|
||||
model.Args.AddRange(appendArgs);
|
||||
}
|
||||
var methodValue = GetMdthodValue(name, model);
|
||||
if (parameter.BaseExpression is BinaryExpression && parameter.OppsiteExpression.Type == UtilConstants.BoolType&&name=="HasValue") {
|
||||
methodValue = this.Context.DbMehtods.CaseWhen(new List<KeyValuePair<string, string>>() {
|
||||
new KeyValuePair<string, string>("IF",methodValue.ObjToString()),
|
||||
new KeyValuePair<string, string>("Return","1"),
|
||||
new KeyValuePair<string, string>("End","0")
|
||||
});
|
||||
}
|
||||
base.AppendValue(parameter, isLeft, methodValue);
|
||||
}
|
||||
|
||||
|
||||
@@ -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.1")]
|
||||
[assembly: AssemblyFileVersion("4.6.0.1")]
|
||||
[assembly: AssemblyVersion("4.6.0.2")]
|
||||
[assembly: AssemblyFileVersion("4.6.0.2")]
|
||||
|
||||
Reference in New Issue
Block a user