- 修复 GroupBy + WithTempQuery + .Key.xx + 特性名与实体不同 + 三元表达式解析问题;

This commit is contained in:
2881099
2023-09-10 00:57:44 +08:00
parent 29943a05c3
commit f117b1452e
3 changed files with 54 additions and 6 deletions

View File

@ -89,6 +89,19 @@ namespace FreeSql.Internal
field.Append(_common.FieldAsAlias(parent.DbNestedField));
}
}
var isGroupAddField = true;
var isGroupAddFieldProvider = diymemexp as SelectGroupingProvider;
if (isGroupAddFieldProvider?._addFieldAlias == true)
{
switch (exp.NodeType)
{
case ExpressionType.Conditional:
case ExpressionType.Call:
isGroupAddField = false;
isGroupAddFieldProvider._addFieldAlias = false;
break;
}
}
Func<ExpTSC> getTSC = () => new ExpTSC { _tables = _tables, _tableRule = _tableRule, diymemexp = diymemexp, tbtype = SelectTableInfoType.From, isQuoteName = true, isDisableDiyParse = false, style = ExpressionStyle.Where, whereGlobalFilter = whereGlobalFilter, dbParams = select?._params }; //#462 添加 DbParams 解决
switch (exp.NodeType)
@ -542,6 +555,7 @@ namespace FreeSql.Internal
field.Append(", ").Append(parent.DbField);
LocalSetFieldAlias(ref index, false);
if (parent.CsType == null && exp.Type.IsValueType) parent.CsType = exp.Type;
if (isGroupAddField == false && isGroupAddFieldProvider != null) isGroupAddFieldProvider._addFieldAlias = true;
return false;
}
public object ReadAnonymous(ReadAnonymousTypeInfo parent, DbDataReader dr, ref int index, bool notRead, ReadAnonymousDbValueRef dbValue, int rowIndex,