mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
-
This commit is contained in:
parent
10d9e9a180
commit
280d682715
@ -28,6 +28,7 @@ namespace OrmTest.ExpressionTest
|
||||
whereSingle5();
|
||||
whereSingle6();
|
||||
WhereMultiple1();
|
||||
WhereMultiple2();
|
||||
}
|
||||
base.End("Where Test");
|
||||
}
|
||||
@ -42,6 +43,22 @@ namespace OrmTest.ExpressionTest
|
||||
new SugarParameter("@Id0",1)
|
||||
}, "WhereMultiple1");
|
||||
}
|
||||
private void WhereMultiple2()
|
||||
{
|
||||
string name = "a";
|
||||
WhereConst.name = "a1";
|
||||
Expression<Func<Student, bool>> exp = it => (it.Id > 1 && it.Name != name || it.Id == 1) || it.Name == WhereConst.name;
|
||||
ExpressionContext expContext = new ExpressionContext(exp, ResolveExpressType.WhereMultiple);
|
||||
expContext.Resolve();
|
||||
var value = expContext.Result.GetString();
|
||||
var pars = expContext.Parameters;
|
||||
base.Check(value, pars, " (((( it.Id > @Id0 ) AND ( it.Name <> @Name1 )) OR ( it.Id = @Id2 )) OR ( it.Name = @Name3 ))", new List<SugarParameter>() {
|
||||
new SugarParameter("@Id0",1),
|
||||
new SugarParameter("@Name1","a"),
|
||||
new SugarParameter("@Id2",1),
|
||||
new SugarParameter("@Name3","a1")
|
||||
}, "WhereMultiple2");
|
||||
}
|
||||
private void whereSingle1()
|
||||
{
|
||||
Expression<Func<Student, bool>> exp = it => it.Id > 1;
|
||||
|
@ -17,7 +17,7 @@ namespace OrmTest
|
||||
static void Main(string[] args)
|
||||
{
|
||||
//Expression To Sql Unit Test
|
||||
int eachCount = 1;
|
||||
int eachCount = 1000;
|
||||
new OrmTest.ExpressionTest.Select(eachCount).Init();
|
||||
new OrmTest.ExpressionTest.Field(eachCount).Init();
|
||||
new OrmTest.ExpressionTest.Where(eachCount).Init();
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user