public void TestOrIfNotEmpty_1() { //结果 var result = new String(); result.Append("Where [Email] In (@_p_0,@_p_1)"); //执行 var list = new List <string> { "a", "b" }; _clause.OrIfNotEmpty <Sample>(t => list.Contains(t.Email)); //验证 Assert.Equal(result.ToString(), GetSql()); }
/// <summary> /// Or连接条件 /// </summary> /// <typeparam name="TEntity">实体类型</typeparam> /// <param name="conditions">查询条件,如果表达式中的值为空,泽忽略该查询条件</param> /// <returns></returns> public ISqlBuilder OrIfNotEmpty <TEntity>(params Expression <Func <TEntity, bool> >[] conditions) { WhereClause.OrIfNotEmpty(conditions); return(this); }