判断是否为null
whereExpression = p =>string.IsNullOrWhiteSpace(p.RealName)
等同于
SELECT * FROM tbl WHERE RealNameIS NULL
判断以什么开头,前缀匹配
whereExpression = p =>p.RealName.StartsWith("AA")
等同于
SELECT * FROM tbl WHERE RealName like 'AA%'
判断以什么结尾,后缀匹配
whereExpression = p =>p.RealName.EndWith("AA")
等同于
SELECT * FROM tbl WHERE RealName like '%AA'
包含查询
whereExpression = p =>p.RealName.Contains("AA")
等同于
SELECT * FROM tbl WHERE RealName like '%AA%'
其他自定义特殊 查询
var pattern = $"______{str}%"; //‘_’ like中的占位符 此处查询第7位为指定字符的数据,str为变量
whereExpression = p => SqlFunctions.PatIndex(pattern, p.RealSampleNo) > 0
等同于
SELECT * FROM tbl WHERE RealName like '______{str}%'
** 长度查询 **
whereExpression = p =>p.RealName.Length==1
** 字节长度查询 **
whereExpression = p =>SqlFunctions.DataLength(p.RealName)==8