Expression support IsNullOrWhiteSpace

This commit is contained in:
skx 2020-12-04 19:52:19 +08:00
parent 68dec8af24
commit f62c15d74d
2 changed files with 9 additions and 0 deletions

View File

@ -44,6 +44,7 @@ namespace OrmTest
var getByFuns2 = db.Queryable<Order>().GroupBy(it => it.Name).Select(it => SqlFunc.AggregateDistinctCount(it.Price)).ToList();
var getDicionary = db.Queryable<Order>().ToDictionary(it => it.Id, it => it.Name);
var getDicionaryList = db.Queryable<Order>().ToDictionaryList();
var getTest = db.Queryable<Order>().Where(it =>string.IsNullOrWhiteSpace( it.Name)).ToList();
Console.WriteLine("#### Examples End ####");
}

View File

@ -512,6 +512,10 @@ namespace SqlSugar
{
name = "To" + TempParseType.Name;
}
else if (name == "IsNullOrWhiteSpace")
{
name = "IsNullOrEmpty";
}
switch (name)
{
case "IIF":
@ -696,6 +700,10 @@ namespace SqlSugar
{
return true;
}
if (expression.Method.Name == "IsNullOrWhiteSpace" && expression.Method.DeclaringType == UtilConstants.StringType)
{
return true;
}
if (expression.Method.ReflectedType().FullName != ExpressionConst.SqlFuncFullName)
return false;
else