private static TableQuery <DynamicTableEntity> GenerateListTablesQuery(string prefix, int?maxResults) { TableQuery <DynamicTableEntity> tableQuery = new TableQuery <DynamicTableEntity>(); if (!string.IsNullOrEmpty(prefix)) { string givenValue = prefix + "{"; tableQuery = tableQuery.Where(TableQuery.CombineFilters(TableQuery.GenerateFilterCondition("TableName", "ge", prefix), "and", TableQuery.GenerateFilterCondition("TableName", "lt", givenValue))); } if (maxResults.HasValue) { tableQuery = tableQuery.Take(maxResults.Value); } return(tableQuery); }
//Azure SDK changes, you are killing me. public static async IAsyncEnumerable <DynamicTableEntity> ExecuteQueryAsync(this CloudTable ct, TableQuery tq) { TableContinuationToken t = new TableContinuationToken(); #if DEBUG int iCounter = 0; #endif while (t != null) { TableQuerySegment <DynamicTableEntity> segment = await ct.ExecuteQuerySegmentedAsync(tq, t).ConfigureAwait(false); foreach (var result in segment.Results) { #if DEBUG iCounter++; #endif yield return(result); } t = segment.ContinuationToken; } #if DEBUG Debug.WriteLine("ExecuteQueryAsync: (Count): {0}", iCounter); Debug.WriteLine("ExecuteQueryAsync (Query): " + tq.FilterString); #endif }