mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 18:52:50 +08:00
- 修复 ToSql AsProperty 大小别名问题;
This commit is contained in:
parent
3a58084afc
commit
c43a90787c
@ -379,6 +379,17 @@ namespace base_entity
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
Expression<Func<HzyTuple<User1, Group, Group, Group, Group, Group>, bool>> where = null;
|
||||||
|
where = where.Or(a => a.t6.Index > 0);
|
||||||
|
where = where.Or(a => a.t5.Index > 0);
|
||||||
|
where = where.Or(a => a.t4.Index > 0);
|
||||||
|
where = where.Or(a => a.t3.Index > 0);
|
||||||
|
where = where.Or(a => a.t2.Index > 0);
|
||||||
|
where = where.Or(a => a.t1.Nickname.Length > 0);
|
||||||
|
|
||||||
|
var sql11224333 = fsql.Select<User1, Group, Group, Group, Group, Group>().Where(where).ToSql();
|
||||||
|
|
||||||
|
|
||||||
fsql.UseJsonMap();
|
fsql.UseJsonMap();
|
||||||
|
|
||||||
fsql.CodeFirst.ConfigEntity<TestClass>(cf =>
|
fsql.CodeFirst.ConfigEntity<TestClass>(cf =>
|
||||||
|
@ -800,14 +800,5 @@
|
|||||||
<param name="that"></param>
|
<param name="that"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Microsoft.Extensions.DependencyInjection.FreeSqlRepositoryDependencyInjection.AddFreeRepository(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Action{FreeSql.FluentDataFilter},System.Reflection.Assembly[])">
|
|
||||||
<summary>
|
|
||||||
批量注入 Repository,可以参考代码自行调整
|
|
||||||
</summary>
|
|
||||||
<param name="services"></param>
|
|
||||||
<param name="globalDataFilter"></param>
|
|
||||||
<param name="assemblies"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
</members>
|
</members>
|
||||||
</doc>
|
</doc>
|
||||||
|
@ -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,
|
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)
|
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)
|
void LocalSetFieldAlias(ref int localIndex, bool isdiymemexp)
|
||||||
{
|
{
|
||||||
if (localIndex >= 0)
|
if (localIndex >= 0)
|
||||||
@ -63,7 +73,7 @@ namespace FreeSql.Internal
|
|||||||
else if (string.IsNullOrEmpty(parent.CsName) == false)
|
else if (string.IsNullOrEmpty(parent.CsName) == false)
|
||||||
{
|
{
|
||||||
parent.DbNestedField = GetFieldAsCsName(parent.CsName);
|
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));
|
field.Append(_common.FieldAsAlias(parent.DbNestedField));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -253,7 +263,7 @@ namespace FreeSql.Internal
|
|||||||
else if (string.IsNullOrEmpty(parent.CsName) == false)
|
else if (string.IsNullOrEmpty(parent.CsName) == false)
|
||||||
{
|
{
|
||||||
dbNestedField = GetFieldAsCsName(parent.CsName);
|
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));
|
field.Append(_common.FieldAsAlias(dbNestedField));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user