Skip to content

Commit d8ff2c4

Browse files
committed
Move nested type to proper place within type members structure
1 parent ae061de commit d8ff2c4

1 file changed

Lines changed: 19 additions & 17 deletions

File tree

Orm/Xtensive.Orm/Orm/PrefetchQuery.cs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,25 @@ namespace Xtensive.Orm
2121
/// <typeparam name="TElement">The type of the queried elements.</typeparam>
2222
public readonly struct PrefetchQuery<TElement> : IEnumerable<TElement>, IAsyncEnumerable<TElement>
2323
{
24+
#region Nested types
25+
private class ExecuteAsyncResult : IEnumerable<TElement>
26+
{
27+
private readonly List<TElement> items;
28+
// We need to hold StrongReferenceContainer to prevent loaded entities from being collected
29+
private readonly StrongReferenceContainer referenceContainer;
30+
31+
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
32+
33+
public IEnumerator<TElement> GetEnumerator() => items.GetEnumerator();
34+
35+
public ExecuteAsyncResult(List<TElement> items, StrongReferenceContainer referenceContainer)
36+
{
37+
this.items = items;
38+
this.referenceContainer = referenceContainer;
39+
}
40+
}
41+
#endregion
42+
2443
private readonly Session session;
2544
private readonly IEnumerable<TElement> source;
2645
private readonly SinglyLinkedList<KeyExtractorNode<TElement>> nodes;
@@ -49,23 +68,6 @@ public IAsyncEnumerator<TElement> GetAsyncEnumerator(CancellationToken token = d
4968
public IAsyncEnumerable<TElement> AsAsyncEnumerable() =>
5069
new PrefetchQueryAsyncEnumerable<TElement>(session, source, nodes);
5170

52-
private class ExecuteAsyncResult : IEnumerable<TElement>
53-
{
54-
private readonly List<TElement> items;
55-
// We need to hold StrongReferenceContainer to prevent loaded entities from being collected
56-
private readonly StrongReferenceContainer referenceContainer;
57-
58-
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
59-
60-
public IEnumerator<TElement> GetEnumerator() => items.GetEnumerator();
61-
62-
public ExecuteAsyncResult(List<TElement> items, StrongReferenceContainer referenceContainer)
63-
{
64-
this.items = items;
65-
this.referenceContainer = referenceContainer;
66-
}
67-
}
68-
6971
/// <summary>
7072
/// Asynchronously executes given <see cref="PrefetchQuery{TElement}"/> instance.
7173
/// </summary>

0 commit comments

Comments
 (0)