Browse Source

Synchronization code

pull/40/head
sunkaixuan 1 year ago
parent
commit
ca50e84b34
  1. 2
      Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableHelper.cs
  2. 4
      Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/ExpressionTool.cs

2
Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableHelper.cs

@ -614,7 +614,7 @@ namespace SqlSugar
{ {
var value = item.Value; var value = item.Value;
var expressionTree = new ExpressionTreeVisitor().GetExpressions(value); var expressionTree = new ExpressionTreeVisitor().GetExpressions(value);
var isSqlMethod = ExpressionTool.GetMethodName(expressionTree.Last()).IsIn("Any", "Count"); var isSqlMethod = expressionTree.Any()&&ExpressionTool.GetMethodName(expressionTree.Last()).IsIn("Any", "Count");
if (expressionTree.Any()&&isSqlMethod==false) if (expressionTree.Any()&&isSqlMethod==false)
{ {

4
Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/ExpressionTool.cs

@ -41,6 +41,10 @@ namespace SqlSugar
return GetMemberBindingItemList((caseExp as MemberInitExpression).Bindings); return GetMemberBindingItemList((caseExp as MemberInitExpression).Bindings);
} }
var exp= caseExp as NewExpression; var exp= caseExp as NewExpression;
if (exp == null)
{
Check.ExceptionEasy("Use Select(it=>new class(){})", "导航查询请使用Select(it=>new class(){})");
}
var dict = new Dictionary<string, Expression>(); var dict = new Dictionary<string, Expression>();
for (int i = 0; i < exp.Arguments.Count; i++) for (int i = 0; i < exp.Arguments.Count; i++)

Loading…
Cancel
Save