本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Table.CloudTable.ExecuteQuerySegmented方法的典型用法代码示例。如果您正苦于以下问题:C# CloudTable.ExecuteQuerySegmented方法的具体用法?C# CloudTable.ExecuteQuerySegmented怎么用?C# CloudTable.ExecuteQuerySegmented使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.WindowsAzure.Storage.Table.CloudTable
的用法示例。
在下文中一共展示了CloudTable.ExecuteQuerySegmented方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyTable
private void CopyTable(CloudTable table)
{
var destTableClient = _destAccount.CreateCloudTableClient();
ConsoleWrite.Verbose(" Creating Table {0}", table.Name);
var destTable = destTableClient.GetTableReference(table.Name);
if (_args.IsReal)
destTable.Create();
var tableQuery = new TableQuery();
TableContinuationToken continuationToken = null;
do
{
var tableQueryResult =
table.ExecuteQuerySegmented(tableQuery, continuationToken);
continuationToken = tableQueryResult.ContinuationToken;
ConsoleWrite.Verbose(" Retrieved {0} rows{1}.", tableQueryResult.Results.Count, continuationToken != null ? " of more" : "");
foreach (var entity in tableQueryResult)
CopyEntity(entity, destTable);
} while (continuationToken != null);
}
示例2: ExecuteBalanceQuery
private IEnumerable<DynamicTableEntity> ExecuteBalanceQuery(CloudTable table, TableQuery tableQuery, IEnumerable<int> pages)
{
pages = pages ?? new int[0];
var pagesEnumerator = pages.GetEnumerator();
TableContinuationToken continuation = null;
do
{
tableQuery.TakeCount = pagesEnumerator.MoveNext() ? (int?)pagesEnumerator.Current : null;
var segment = table.ExecuteQuerySegmented(tableQuery, continuation);
continuation = segment.ContinuationToken;
foreach(var entity in segment)
{
yield return entity;
}
} while(continuation != null);
}
示例3: ProcessEntities
private static void ProcessEntities(CloudTable table, Action<IEnumerable<DynamicTableEntity>> processor, Expression<Func<DynamicTableEntity, bool>> filters)
{
TableQuerySegment<DynamicTableEntity> segment = null;
while (segment == null || segment.ContinuationToken != null)
{
if (filters == null)
{
segment = table.ExecuteQuerySegmented(new TableQuery().Take(100), segment == null ? null : segment.ContinuationToken);
}
else
{
var query = table.CreateQuery<DynamicTableEntity>().Where(filters).Take(100).AsTableQuery();
segment = query.ExecuteSegmented(segment == null ? null : segment.ContinuationToken);
}
processor(segment.Results);
}
}
示例4: RetrieveAll
static List<DynamicTableEntity> RetrieveAll(CloudTable table, IQueryable<DynamicTableEntity> query)
{
var entities = new List<DynamicTableEntity>();
TableContinuationToken token = null;
do
{
var page = query.Take(512);
var segment = table.ExecuteQuerySegmented((TableQuery<DynamicTableEntity>)page, token);
token = segment.ContinuationToken;
entities.AddRange(segment.Results);
}
while (token != null);
return entities;
}