Example #1
0
        private async Task <List <KeyValuePair <long, StateEntity> > > ReadStates()
        {
            var query       = AzureTableUtils.RangeQuery(this.partition, StateEntity.RK_MIN, StateEntity.RK_MAX);
            var results     = new List <KeyValuePair <long, StateEntity> >();
            var queryResult = table.QueryAsync <TableEntity>(query).ConfigureAwait(false);

            await foreach (var entity in queryResult)
            {
                var state = new StateEntity(entity);
                results.Add(new KeyValuePair <long, StateEntity>(state.SequenceId, state));
            }
            ;
            return(results);
        }
        private async Task <List <KeyValuePair <long, StateEntity> > > ReadStates()
        {
            var query = new TableQuery <StateEntity>()
                        .Where(AzureTableUtils.RangeQuery(this.partition, StateEntity.RK_MIN, StateEntity.RK_MAX));
            TableContinuationToken continuationToken = null;
            var results = new List <KeyValuePair <long, StateEntity> >();

            do
            {
                TableQuerySegment <StateEntity> queryResult = await table.ExecuteQuerySegmentedAsync(query, continuationToken).ConfigureAwait(false);

                foreach (var x in queryResult.Results)
                {
                    results.Add(new KeyValuePair <long, StateEntity>(x.SequenceId, x));
                }
                ;
                continuationToken = queryResult.ContinuationToken;
            } while (continuationToken != null);
            return(results);
        }