Skip to content

Commit 65bbee9

Browse files
committed
- 修复 嵌套查询DTO映射可能触发循环引用 bug;
1 parent 0b8f212 commit 65bbee9

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Extensions/FreeSql.Extensions.ZoreEntity/FreeSql.Extensions.ZoreEntity.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<SignAssembly>true</SignAssembly>
1919
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
2020
<DelaySign>false</DelaySign>
21-
<Version>3.2.807-preview20231214</Version>
21+
<Version>3.2.806</Version>
2222
<PackageReadmeFile>readme.md</PackageReadmeFile>
2323
</PropertyGroup>
2424

FreeSql/Internal/CommonExpression.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2568,6 +2568,7 @@ public List<Expression[]> MatchDtoPropertys(SelectTableInfo tb, PropertyInfo dto
25682568
{
25692569
if (tb == null || dtoProp == null || tb.Parameter == null) return null;
25702570
var retList = new List<Expression[]>();
2571+
var matchIgnores = new Dictionary<PropertyInfo, bool>();
25712572
var retExp = LocalMatch(tb.Parameter.Type, tb.Parameter);
25722573
if (retList.Any() == false) retList.Add(new[] { retExp });
25732574
return retList;
@@ -2584,7 +2585,9 @@ Expression LocalMatch(Type type, Expression memExp)
25842585
if (Utils.dicExecuteArrayRowReadClassOrTuple.ContainsKey(typeProp.PropertyType)) continue;
25852586
if (typeProp.PropertyType.IsAnonymousType() || _common.GetTableByEntity(typeProp.PropertyType)?.Columns.Any() == true)
25862587
{
2587-
var nextExp = Expression.MakeMemberAccess(memExp, typeProp);
2588+
if (matchIgnores.ContainsKey(typeProp)) continue;
2589+
matchIgnores.Add(typeProp, true);
2590+
var nextExp = Expression.MakeMemberAccess(memExp, typeProp);
25882591
var ret = LocalMatch(typeProp.PropertyType, nextExp);
25892592
if (ret != null)
25902593
{

0 commit comments

Comments
 (0)