2017-01-28 21:56:15 +08:00
|
|
|
|
using OrmTest.Models;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Linq.Expressions;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace OrmTest.ExpressionTest
|
|
|
|
|
{
|
|
|
|
|
public class Method : ExpTestBase
|
|
|
|
|
{
|
|
|
|
|
private Method() { }
|
|
|
|
|
public Method(int eachCount)
|
|
|
|
|
{
|
|
|
|
|
this.Count = eachCount;
|
|
|
|
|
}
|
|
|
|
|
internal void Init()
|
|
|
|
|
{
|
|
|
|
|
base.Begin();
|
|
|
|
|
for (int i = 0; i < base.Count; i++)
|
|
|
|
|
{
|
2017-01-30 15:10:54 +08:00
|
|
|
|
StringIsNullOrEmpty();
|
2017-01-28 21:56:15 +08:00
|
|
|
|
}
|
|
|
|
|
base.End("Method Test");
|
|
|
|
|
}
|
2017-01-30 15:10:54 +08:00
|
|
|
|
private void StringIsNullOrEmpty()
|
|
|
|
|
{
|
|
|
|
|
Expression<Func<Student, bool>> exp = it =>it.Id>2|| NBORM.IsNullOrEmpty(it.Id);;
|
|
|
|
|
SqlServerExpressionContext expContext = new SqlServerExpressionContext(exp, ResolveExpressType.WhereSingle);
|
|
|
|
|
expContext.Resolve();
|
|
|
|
|
var value = expContext.Result.GetString();
|
|
|
|
|
var pars = expContext.Parameters;
|
|
|
|
|
base.Check(value, pars, "(( Id > @Id0 ) OR ( Id='' OR Id IS NULL ))", new List<SugarParameter>() {
|
|
|
|
|
new SugarParameter("@Id0",2)
|
|
|
|
|
}, "whereSingle1");
|
|
|
|
|
}
|
2017-01-28 21:56:15 +08:00
|
|
|
|
}
|
|
|
|
|
}
|