mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 12:28:15 +08:00
- 修复 ToSql AsProperty 大小别名问题;
This commit is contained in:
@ -51,6 +51,16 @@ namespace FreeSql.Internal
|
||||
public bool ReadAnonymousField(List<SelectTableInfo> _tables, Func<Type, string, string> _tableRule, StringBuilder field, ReadAnonymousTypeInfo parent, ref int index, Expression exp, Select0Provider select,
|
||||
BaseDiyMemberExpression diymemexp, List<GlobalFilter.Item> whereGlobalFilter, List<string> findIncludeMany, List<Expression> findSubSelectMany, bool isAllDtoMap)
|
||||
{
|
||||
bool LocalEndsWithField(string dbField, string dbNestedField)
|
||||
{
|
||||
switch (_ado.DataType)
|
||||
{
|
||||
case DataType.SqlServer:
|
||||
case DataType.OdbcSqlServer:
|
||||
return dbField.EndsWith(dbNestedField, StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
return dbField.EndsWith(dbNestedField);
|
||||
}
|
||||
void LocalSetFieldAlias(ref int localIndex, bool isdiymemexp)
|
||||
{
|
||||
if (localIndex >= 0)
|
||||
@ -63,7 +73,7 @@ namespace FreeSql.Internal
|
||||
else if (string.IsNullOrEmpty(parent.CsName) == false)
|
||||
{
|
||||
parent.DbNestedField = GetFieldAsCsName(parent.CsName);
|
||||
if (localIndex == ReadAnonymousFieldAsCsName && parent.DbField.EndsWith(parent.DbNestedField, StringComparison.CurrentCultureIgnoreCase) == false) //DbField 和 CsName 相同的时候,不处理
|
||||
if (localIndex == ReadAnonymousFieldAsCsName && LocalEndsWithField(parent.DbField, parent.DbNestedField) == false) //DbField 和 CsName 相同的时候,不处理
|
||||
field.Append(_common.FieldAsAlias(parent.DbNestedField));
|
||||
}
|
||||
}
|
||||
@ -253,7 +263,7 @@ namespace FreeSql.Internal
|
||||
else if (string.IsNullOrEmpty(parent.CsName) == false)
|
||||
{
|
||||
dbNestedField = GetFieldAsCsName(parent.CsName);
|
||||
if (index == ReadAnonymousFieldAsCsName && diymemexp._field.EndsWith(dbNestedField, StringComparison.CurrentCultureIgnoreCase) == false) //DbField 和 CsName 相同的时候,不处理
|
||||
if (index == ReadAnonymousFieldAsCsName && LocalEndsWithField(diymemexp._field, dbNestedField) == false) //DbField 和 CsName 相同的时候,不处理
|
||||
field.Append(_common.FieldAsAlias(dbNestedField));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user