Skip to content

Commit f8ad904

Browse files
committed
- 修复 ToChunk + Include 三层导航属性返回问题;#2056
1 parent e64fd7b commit f8ad904

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

FreeSql/Internal/CommonProvider/SelectProvider/Select0ProviderReader.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public void ToChunk(int size, Action<FetchCallbackArgs<List<T1>>> done)
248248
return;
249249
}
250250
if (_selectExpression != null) throw new ArgumentException(CoreErrorStrings.Before_Chunk_Cannot_Use_Select);
251-
this.ToListChunkPrivate(size, done, this.GetAllFieldExpressionTreeLevel2(), null);
251+
this.ToListChunkPrivate(size, done, !_isIncluded ? this.GetAllFieldExpressionTreeLevel2() : this.GetAllFieldExpressionTreeLevelAll(), null);
252252
}
253253

254254
internal void ToListMrChunkPrivate<TReturn>(int chunkSize, Action<FetchCallbackArgs<List<TReturn>>> chunkDone, string sql, ReadAnonymousTypeAfInfo af)
@@ -315,7 +315,7 @@ public Dictionary<TKey, TElement> ToDictionary<TKey, TElement>(Func<T1, TKey> ke
315315

316316
var ret = new Dictionary<TKey, TElement>();
317317
if (_cancel?.Invoke() == true) return ret;
318-
var af = this.GetAllFieldExpressionTreeLevel2();
318+
var af = !_isIncluded ? this.GetAllFieldExpressionTreeLevel2() : this.GetAllFieldExpressionTreeLevelAll();
319319
var sql = this.ToSql(af.Field);
320320
var dbParms = _params.ToArray();
321321
var before = new Aop.CurdBeforeEventArgs(_tables[0].Table.Type, _tables[0].Table, Aop.CurdType.Select, sql, dbParms);
@@ -1342,7 +1342,7 @@ async public Task<Dictionary<TKey, TElement>> ToDictionaryAsync<TKey, TElement>(
13421342

13431343
var ret = new Dictionary<TKey, TElement>();
13441344
if (_cancel?.Invoke() == true) return ret;
1345-
var af = this.GetAllFieldExpressionTreeLevel2();
1345+
var af = !_isIncluded ? this.GetAllFieldExpressionTreeLevel2() : this.GetAllFieldExpressionTreeLevelAll();
13461346
var sql = this.ToSql(af.Field);
13471347
var dbParms = _params.ToArray();
13481348
var before = new Aop.CurdBeforeEventArgs(_tables[0].Table.Type, _tables[0].Table, Aop.CurdType.Select, sql, dbParms);
@@ -1797,7 +1797,7 @@ public IAsyncEnumerable<List<T1>> ToChunkAsyncEnumerable(int size)
17971797
};
17981798
}
17991799
if (_selectExpression != null) throw new ArgumentException(CoreErrorStrings.Before_Chunk_Cannot_Use_Select);
1800-
return this.ToListChunkPrivateAsyncEnumerable(size, this.GetAllFieldExpressionTreeLevel2(), null);
1800+
return this.ToListChunkPrivateAsyncEnumerable(size, !_isIncluded ? this.GetAllFieldExpressionTreeLevel2() : this.GetAllFieldExpressionTreeLevelAll(), null);
18011801
}
18021802

18031803

0 commit comments

Comments
 (0)