mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Bool Exp Bug
This commit is contained in:
parent
8fd8deb4c5
commit
735113ba5a
@ -385,6 +385,8 @@ namespace OrmTest.Demo
|
||||
var test6 = db.Queryable<DataTestInfo2>().Where(it => SqlFunc.HasValue(it.Bool2)==true && SqlFunc.HasValue(it.Bool2)==true).ToList();
|
||||
var test7 = db.Queryable<DataTestInfo2>().Where(it => SqlFunc.HasValue(it.Bool1) && SqlFunc.HasValue(it.Bool1)).ToList();
|
||||
var test8 = db.Queryable<Student>().Where(it => SqlFunc.HasValue(it.SchoolId) && SqlFunc.HasValue(it.SchoolId)).ToList();
|
||||
bool? b = false;
|
||||
var test9 = db.Queryable<DataTestInfo2>().Where(it => it.Bool1 == b).ToList();
|
||||
}
|
||||
public static void Page()
|
||||
{
|
||||
|
@ -82,7 +82,23 @@ namespace OrmTest.UnitTest
|
||||
var pars = expContext.Parameters;
|
||||
base.Check(value, pars, "( [Bool2] = @Bool20 )", new List<SugarParameter>() {
|
||||
new SugarParameter("@Bool20",false)
|
||||
}, "whereSingle30");
|
||||
}, "whereSingle31");
|
||||
|
||||
whereSingle32();
|
||||
}
|
||||
|
||||
|
||||
private void whereSingle32()
|
||||
{
|
||||
bool? b = false;
|
||||
Expression<Func<DataTestInfo2, bool>> exp = it => it.Bool1 == b;
|
||||
SqlServerExpressionContext expContext = new SqlServerExpressionContext();
|
||||
expContext.Resolve(exp, ResolveExpressType.WhereSingle);
|
||||
var value = expContext.Result.GetString();
|
||||
var pars = expContext.Parameters;
|
||||
base.Check(value, pars, "( [Bool1] = @Bool10 )", new List<SugarParameter>() {
|
||||
new SugarParameter("@Bool10",false)
|
||||
}, "whereSingle32");
|
||||
}
|
||||
|
||||
public string Get28(string a) {
|
||||
|
@ -36,6 +36,10 @@ namespace SqlSugar
|
||||
{
|
||||
leftExpression = (leftExpression as UnaryExpression).Operand;
|
||||
}
|
||||
if (leftExpression is UnaryExpression && (leftExpression as UnaryExpression).Operand.Type == UtilConstants.BoolType && (leftExpression as UnaryExpression).NodeType != ExpressionType.Not&&rightExpression.Type==UtilConstants.BoolTypeNull)
|
||||
{
|
||||
leftExpression = (leftExpression as UnaryExpression).Operand;
|
||||
}
|
||||
if (rightExpression is UnaryExpression&& (rightExpression as UnaryExpression).Operand.Type==UtilConstants.BoolType&& (rightExpression as UnaryExpression).NodeType != ExpressionType.Not)
|
||||
{
|
||||
rightExpression = (rightExpression as UnaryExpression).Operand;
|
||||
|
@ -19,6 +19,7 @@ namespace SqlSugar
|
||||
internal static Type LongType = typeof(long);
|
||||
internal static Type GuidType = typeof(Guid);
|
||||
internal static Type BoolType = typeof(bool);
|
||||
internal static Type BoolTypeNull = typeof(bool?);
|
||||
internal static Type ByteType = typeof(Byte);
|
||||
internal static Type ObjType = typeof(object);
|
||||
internal static Type DobType = typeof(double);
|
||||
|
Loading…
Reference in New Issue
Block a user