Skip to content

Commit 2711a44

Browse files
committed
Properly refresh continuation token for enumerating all entities
Fixes #53
1 parent b9f4682 commit 2711a44

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

src/TableStorage/DocumentRepository`1.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ async IAsyncEnumerable<T> EnumerateBinaryAsync(Expression<Func<IDocumentEntity,
138138
var segment = await table.ExecuteQuerySegmentedAsync(query, continuation, cancellation)
139139
.ConfigureAwait(false);
140140

141+
continuation = segment.ContinuationToken;
142+
141143
foreach (var entity in segment)
142144
{
143145
if (entity != null && entity.Document != null)
@@ -214,6 +216,8 @@ async IAsyncEnumerable<T> EnumerateStringAsync(Expression<Func<IDocumentEntity,
214216
var segment = await table.ExecuteQuerySegmentedAsync(query, continuation, cancellation)
215217
.ConfigureAwait(false);
216218

219+
continuation = segment.ContinuationToken;
220+
217221
foreach (var entity in segment)
218222
{
219223
if (entity != null && entity.Document != null)

src/TableStorage/TableEntityRepository.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ public async IAsyncEnumerable<ITableEntity> EnumerateAsync(string? partitionKey
7777
var segment = await table.ExecuteQuerySegmentedAsync(query, continuation, cancellation)
7878
.ConfigureAwait(false);
7979

80+
continuation = segment.ContinuationToken;
81+
8082
foreach (var entity in segment)
8183
if (entity != null)
8284
yield return entity;

src/TableStorage/TableRepository`1.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ public async IAsyncEnumerable<T> EnumerateAsync(string? partitionKey = default,
109109
{
110110
var segment = await table.ExecuteQuerySegmentedAsync(query, continuation, cancellation)
111111
.ConfigureAwait(false);
112-
112+
113+
continuation = segment.ContinuationToken;
114+
113115
foreach (var entity in segment)
114116
if (entity != null)
115117
yield return ToEntity(entity);

src/Tests/RepositoryTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Threading;
34
using System.Threading.Tasks;
45
using Microsoft.Azure.Cosmos.Table;
56
using Xunit;

0 commit comments

Comments
 (0)