本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Table.TableContinuationToken类的典型用法代码示例。如果您正苦于以下问题:C# TableContinuationToken类的具体用法?C# TableContinuationToken怎么用?C# TableContinuationToken使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TableContinuationToken类属于Microsoft.WindowsAzure.Storage.Table命名空间,在下文中一共展示了TableContinuationToken类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetEvents
public TableQuerySegment<EventEntity> GetEvents(TableContinuationToken token, EventFilter filter)
{
var list = (from events in table.CreateQuery<EventEntity>()
where events.alerttype.Equals(filter.type) select events
);
TableQuery<EventEntity> query = new TableQuery<EventEntity>().Where(filter.GetFilterString()).Take(100);
TableQuerySegment<EventEntity> resultSegment = table.ExecuteQuerySegmented(query, token);
return resultSegment;
}
示例2: SerializeToken
public string SerializeToken(TableContinuationToken tableContinuationToken)
{
if (tableContinuationToken == null) return string.Empty;
var serialized = JsonConvert.SerializeObject(tableContinuationToken);
var bytes = Encoding.UTF8.GetBytes(serialized);
return Convert.ToBase64String(bytes);
}
示例3: GetAllEvents
public TableQuerySegment<EventEntity> GetAllEvents(TableContinuationToken token)
{
TableQuery<EventEntity> query = new TableQuery<EventEntity>().Take(100);
TableQuerySegment<EventEntity> resultSegment = table.ExecuteQuerySegmented(query, token);
return resultSegment;
}
示例4: QueryImpl
private static RESTCommand<TableQuerySegment> QueryImpl(TableQuery query, TableContinuationToken token, CloudTableClient client, string tableName, TableRequestOptions requestOptions)
{
UriQueryBuilder builder = query.GenerateQueryBuilder();
if (token != null)
{
token.ApplyToUriQueryBuilder(builder);
}
StorageUri tempUriList = NavigationHelper.AppendPathToUri(client.StorageUri, tableName);
RESTCommand<TableQuerySegment> queryCmd = new RESTCommand<TableQuerySegment>(client.Credentials, tempUriList);
requestOptions.ApplyToStorageCommand(queryCmd);
queryCmd.CommandLocationMode = CommonUtility.GetListingLocationMode(token);
queryCmd.RetrieveResponseStream = true;
queryCmd.Handler = client.AuthenticationHandler;
queryCmd.BuildClient = HttpClientFactory.BuildHttpClient;
queryCmd.Builder = builder;
queryCmd.BuildRequest = (cmd, uri, queryBuilder, cnt, serverTimeout, ctx) => TableOperationHttpRequestMessageFactory.BuildRequestForTableQuery(uri, builder, serverTimeout, cnt, ctx);
queryCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp.StatusCode, null /* retVal */, cmd, ex);
queryCmd.PostProcessResponse = async (cmd, resp, ctx) =>
{
TableQuerySegment resSeg = await TableOperationHttpResponseParsers.TableQueryPostProcess(cmd.ResponseStream, resp, ctx);
if (resSeg.ContinuationToken != null)
{
resSeg.ContinuationToken.TargetLocation = cmd.CurrentResult.TargetLocation;
}
return resSeg;
};
return queryCmd;
}
示例5: ExecuteQuerySegmented
internal TableQuerySegment<DynamicTableEntity> ExecuteQuerySegmented(TableContinuationToken token, CloudTableClient client, string tableName, TableRequestOptions requestOptions, OperationContext operationContext)
{
CommonUtils.AssertNotNullOrEmpty("tableName", tableName);
TableRequestOptions modifiedOptions = TableRequestOptions.ApplyDefaults(requestOptions, client);
operationContext = operationContext ?? new OperationContext();
RESTCommand<TableQuerySegment<DynamicTableEntity>> cmdToExecute = QueryImpl(this, token, client, tableName, modifiedOptions);
return Executor.ExecuteSync(cmdToExecute, modifiedOptions.RetryPolicy, operationContext);
}
示例6: Serialize
public string Serialize(TableContinuationToken continuationToken)
{
if (continuationToken == null) return null;
StringBuilder sb = new StringBuilder();
using (XmlWriter xmlWriter = XmlWriter.Create(new StringWriter(sb)))
{
continuationToken.WriteXml(xmlWriter);
}
return sb.ToString();
}
开发者ID:JamesRandall,项目名称:AccidentalFish.ApplicationSupport,代码行数:10,代码来源:TableContinuationTokenSerializer.cs
示例7: Serialize
public string Serialize(TableContinuationToken continuationToken)
{
if (continuationToken == null) return null;
using (StringWriter stringWriter = new StringWriter())
{
using (XmlWriter xmlWriter = XmlWriter.Create(stringWriter))
{
continuationToken.WriteXml(xmlWriter);
}
return stringWriter.ToString();
}
}
开发者ID:vvmoppescapita,项目名称:AccidentalFish.ApplicationSupport,代码行数:13,代码来源:TableContinuationTokenSerializer.cs
示例8: BeginExecuteQuerySegmented
internal ICancellableAsyncResult BeginExecuteQuerySegmented(TableContinuationToken token, CloudTableClient client, string tableName, TableRequestOptions requestOptions, OperationContext operationContext, AsyncCallback callback, object state)
{
CommonUtils.AssertNotNullOrEmpty("tableName", tableName);
TableRequestOptions modifiedOptions = TableRequestOptions.ApplyDefaults(requestOptions, client);
operationContext = operationContext ?? new OperationContext();
return Executor.BeginExecuteAsync(
QueryImpl(this, token, client, tableName, modifiedOptions),
modifiedOptions.RetryPolicy,
operationContext,
callback,
state);
}
示例9: ExecuteQuerySegmentedAsync
internal IAsyncOperation<TableQuerySegment> ExecuteQuerySegmentedAsync(TableContinuationToken continuationToken, CloudTableClient client, string tableName, TableRequestOptions requestOptions, OperationContext operationContext)
{
CommonUtility.AssertNotNullOrEmpty("tableName", tableName);
TableRequestOptions modifiedOptions = TableRequestOptions.ApplyDefaults(requestOptions, client);
operationContext = operationContext ?? new OperationContext();
RESTCommand<TableQuerySegment> cmdToExecute = QueryImpl(this, continuationToken, client, tableName, modifiedOptions);
return AsyncInfo.Run(async (cancellationToken) => await Executor.ExecuteAsync(
cmdToExecute,
modifiedOptions.RetryPolicy,
operationContext,
cancellationToken));
}
示例10: GetTableDataByDate
public async Task<TableQuerySegment<DynamicTableEntity>> GetTableDataByDate(string tableName, string filter, DateTime from, DateTime to, TableContinuationToken continuationToken, bool hasLeadingZero)
{
var fromUtc = from.ToUniversalTime();
var toUtc = to.ToUniversalTime();
var lead = hasLeadingZero ? "0" : "";
string fromFilter = TableQuery.GenerateFilterCondition("PartitionKey",
QueryComparisons.GreaterThanOrEqual, string.Format("{0}{1}", lead, fromUtc.Ticks));
string toFilter = TableQuery.GenerateFilterCondition("PartitionKey",
QueryComparisons.LessThan, string.Format("{0}{1}", lead, toUtc.Ticks));
var filterQuery = TableQuery.CombineFilters(toFilter, TableOperators.And, fromFilter);
if (!String.IsNullOrEmpty(filter))
{
filterQuery = TableQuery.CombineFilters(filter, TableOperators.And, filterQuery);
}
return await GetData(tableName, filterQuery, continuationToken);
}
示例11: CloudTableSegmentedQuery
protected CloudTableSegmentedQuery(
int? take,
string[] properties,
Func<TableQuery<DynamicTableEntity>, TableContinuationToken, Task<TableQuerySegment<DynamicTableEntity>>> fetchEntities,
ITableEntityConverter tableEntityConverter)
{
Require.True(!take.HasValue || take > 0, "take", "Value should contains positive value");
Require.NotNull(properties, "properties");
Require.NotNull(fetchEntities, "fetchEntities");
Require.NotNull(tableEntityConverter, "tableEntityConverter");
m_take = take;
m_properties = properties;
m_fetchEntities = fetchEntities;
m_tableEntityConverter = tableEntityConverter;
m_continuationToken = null;
}
示例12: ClassCleanup
public static void ClassCleanup()
{
var storageAccountProvider = Configuration.GetTestStorageAccount();
var client = new CloudTableClient( new Uri( storageAccountProvider.TableEndpoint ), storageAccountProvider.Credentials );
TableContinuationToken token = new TableContinuationToken();
do
{
var orphanedTables = client.ListTablesSegmentedAsync( _baseTableName, token ).Result;
token = orphanedTables.ContinuationToken;
foreach ( CloudTable orphanedTableName in orphanedTables.Results )
{
client.GetTableReference( orphanedTableName.Name ).DeleteIfExistsAsync().Wait();
}
}
while ( token != null );
}
示例13: ListTablesSegmentedAsync
/// <summary>
/// Returns an enumerable collection of tables in the storage account asynchronously.
/// </summary>
/// <param name="tableClient">Cloud table client.</param>
/// <param name="prefix">The table name prefix.</param>
/// <param name="maxResults">
/// A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the
/// per-operation limit of 5000. If this value is zero the maximum possible number of results will be returned, up to 5000.
/// </param>
/// <param name="continuationToken">Continuation token.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>
/// An enumerable collection of tables that are retrieved lazily.
/// </returns>
public static Task<TableResultSegment> ListTablesSegmentedAsync(
this CloudTableClient tableClient,
string prefix,
int? maxResults,
TableContinuationToken continuationToken,
CancellationToken cancellationToken = default (CancellationToken))
{
ICancellableAsyncResult asyncResult = tableClient.BeginListTablesSegmented(prefix, maxResults, continuationToken, null, null, null, null);
CancellationTokenRegistration registration = cancellationToken.Register(p => asyncResult.Cancel(), null);
return Task<TableResultSegment>.Factory.FromAsync(
asyncResult,
result =>
{
registration.Dispose();
return tableClient.EndListTablesSegmented(result);
});
}
示例14: DeserializeToken
public static TableContinuationToken DeserializeToken(string token)
{
if (!string.IsNullOrWhiteSpace(token))
{
var raw = DecodeBase64(token);
TableContinuationToken contToken = null;
using (var stringReader = new StringReader(raw))
{
contToken = new TableContinuationToken();
using (var xmlReader = XmlReader.Create(stringReader))
{
contToken.ReadXml(xmlReader);
}
}
return contToken;
}
return null;
}
示例15: Get1000Tweets
public TableQuerySegment<TweetTableEntity> Get1000Tweets(ref TableContinuationToken token)
{
var query = new TableQuery();
EntityResolver<TweetTableEntity> tweetTableEntityResolver = (pk, rk, ts, props, etag) =>
{
var resolvedEntity = new TweetTableEntity
{
PartitionKey = pk,
RowKey = rk,
Timestamp = ts,
ETag = etag,
};
resolvedEntity.ReadEntity(props, null);
return resolvedEntity;
};
var segment = _tweetsTable.ExecuteQuerySegmented(query, tweetTableEntityResolver, token);
token = segment.ContinuationToken;
return segment;
}