- 修复 嵌套查询DTO映射可能触发循环引用 bug;

This commit is contained in:
2881099 2023-12-15 19:55:52 +08:00
parent 0b8f2127f7
commit 65bbee93a2
2 changed files with 5 additions and 2 deletions

View File

@ -18,7 +18,7 @@
<SignAssembly>true</SignAssembly> <SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign> <DelaySign>false</DelaySign>
<Version>3.2.807-preview20231214</Version> <Version>3.2.806</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile> <PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup> </PropertyGroup>

View File

@ -2568,6 +2568,7 @@ namespace FreeSql.Internal
{ {
if (tb == null || dtoProp == null || tb.Parameter == null) return null; if (tb == null || dtoProp == null || tb.Parameter == null) return null;
var retList = new List<Expression[]>(); var retList = new List<Expression[]>();
var matchIgnores = new Dictionary<PropertyInfo, bool>();
var retExp = LocalMatch(tb.Parameter.Type, tb.Parameter); var retExp = LocalMatch(tb.Parameter.Type, tb.Parameter);
if (retList.Any() == false) retList.Add(new[] { retExp }); if (retList.Any() == false) retList.Add(new[] { retExp });
return retList; return retList;
@ -2584,7 +2585,9 @@ namespace FreeSql.Internal
if (Utils.dicExecuteArrayRowReadClassOrTuple.ContainsKey(typeProp.PropertyType)) continue; if (Utils.dicExecuteArrayRowReadClassOrTuple.ContainsKey(typeProp.PropertyType)) continue;
if (typeProp.PropertyType.IsAnonymousType() || _common.GetTableByEntity(typeProp.PropertyType)?.Columns.Any() == true) if (typeProp.PropertyType.IsAnonymousType() || _common.GetTableByEntity(typeProp.PropertyType)?.Columns.Any() == true)
{ {
var nextExp = Expression.MakeMemberAccess(memExp, typeProp); if (matchIgnores.ContainsKey(typeProp)) continue;
matchIgnores.Add(typeProp, true);
var nextExp = Expression.MakeMemberAccess(memExp, typeProp);
var ret = LocalMatch(typeProp.PropertyType, nextExp); var ret = LocalMatch(typeProp.PropertyType, nextExp);
if (ret != null) if (ret != null)
{ {