예제 #1
0
        private static async Task <ITable> FetchResults(DbTableSchema dbTableSchema, CloudTable table, TableQuery <DynamicTableEntity> projectionQuery)
        {
            // Initialize the continuation token to null to start from the beginning of the table.
            TableContinuationToken continuationToken = null;

            var tableResult = new AzureTable(dbTableSchema);

            do
            {
                // Retrieve a segment (up to 1,000 entities).
                var tableQueryResult =
                    await table.ExecuteQuerySegmentedAsync(projectionQuery, continuationToken);

                // Assign the new continuation token to tell the service where to
                // continue on the next iteration (or null if it has reached the end).
                continuationToken = tableQueryResult.ContinuationToken;

                foreach (var result in tableQueryResult.Results)
                {
                    tableResult.AddRow(result);
                }

                // Loop until a null continuation token is received, indicating the end of the table.
            } while (continuationToken != null);
            return(tableResult);
        }