- 优化 子查询(多表)别名;

- 优化 IUpdate.Set 支持位运算表达式树解析;
This commit is contained in:
2881099
2020-11-27 12:10:22 +08:00
parent 462a35a9cd
commit b069c81f22
6 changed files with 116 additions and 24 deletions

View File

@ -1009,8 +1009,11 @@ namespace FreeSql.Internal
{
if (fsqltable1SetAlias == false)
{
fsqltables[0].Alias = (argExp as LambdaExpression).Parameters.First().Name;
fsqltable1SetAlias = true;
var argExpLambda = argExp as LambdaExpression;
var fsqlTypeGenericArgs = fsqlType.GetGenericArguments();
for (var gai = 0; gai < fsqlTypeGenericArgs.Length && gai < argExpLambda.Parameters.Count; gai++)
fsqltables[gai].Alias = argExpLambda.Parameters[gai].Name;
}
}
args[a] = argExp ?? Expression.Lambda(arg3Exp).Compile().DynamicInvoke();

View File

@ -457,6 +457,11 @@ namespace FreeSql.Internal.CommonProvider
{
var body = exp?.Body;
var nodeType = body?.NodeType;
if (nodeType == ExpressionType.Convert)
{
body = (body as UnaryExpression)?.Operand;
nodeType = body?.NodeType;
}
switch (nodeType)
{
case ExpressionType.Equal:
@ -499,7 +504,7 @@ namespace FreeSql.Internal.CommonProvider
if (body is BinaryExpression == false &&
nodeType != ExpressionType.Call) return this;
var cols = new List<SelectColumnInfo>();
var expt = _commonExpression.ExpressionWhereLambdaNoneForeignObject(null, _table, cols, exp, null, null);
var expt = _commonExpression.ExpressionWhereLambdaNoneForeignObject(null, _table, cols, body, null, null);
if (cols.Any() == false) return this;
foreach (var col in cols)
{