Skip to content

Commit be7fdb7

Browse files
author
Zhen
committed
Let ForEachAsync directly return result summary after processing all result
1 parent 1da63e4 commit be7fdb7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Neo4j.Driver/Neo4j.Driver/V1/StatementResultCursorExtensions.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,16 @@ public static async Task<List<T>> ToListAsync<T>(this IStatementResultCursor res
9595
/// </summary>
9696
/// <param name="result">The result stream.</param>
9797
/// <param name="operation">The operation is carried out on each record.</param>
98-
/// <returns>A Task that completes when all records have been processed.</returns>
99-
public static async Task ForEachAsync(this IStatementResultCursor result, Action<IRecord> operation)
98+
/// <returns>The result summary after all records have been processed.</returns>
99+
public static async Task<IResultSummary> ForEachAsync(this IStatementResultCursor result, Action<IRecord> operation)
100100
{
101101
Throw.ArgumentNullException.IfNull(result, nameof(result));
102102
while (await result.FetchAsync().ConfigureAwait(false))
103103
{
104104
var record = result.Current;
105105
operation(record);
106106
}
107+
return await result.SummaryAsync().ConfigureAwait(false);
107108
}
108109
}
109110
}

0 commit comments

Comments
 (0)