本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Table.TableContinuationToken类的典型用法代码示例。如果您正苦于以下问题:C# TableContinuationToken类的具体用法?C# TableContinuationToken怎么用?C# TableContinuationToken使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TableContinuationToken类属于Microsoft.WindowsAzure.Storage.Table命名空间,在下文中一共展示了TableContinuationToken类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:thomasjetzinger,项目名称:smarthomecloud,代码行数:11,代码来源:EventDataConnector.cs
示例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);
}
开发者ID:qjuanp,项目名称:azure-table-storage-examples,代码行数:7,代码来源:ContinuationTokenResolver.cs
示例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;
}
开发者ID:thomasjetzinger,项目名称:smarthomecloud,代码行数:7,代码来源:EventDataConnector.cs
示例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;
}
开发者ID:BurtHarris,项目名称:azure-storage-net,代码行数:33,代码来源:TableQuery.cs
示例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);
}
开发者ID:Jasontang501,项目名称:azure-sdk-for-net,代码行数:10,代码来源:TableQueryNonGeneric.cs
示例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);
}
开发者ID:Jasontang501,项目名称:azure-sdk-for-net,代码行数:14,代码来源:TableQueryNonGeneric.cs
示例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));
}
开发者ID:huoxudong125,项目名称:azure-sdk-for-net,代码行数:14,代码来源:TableQuery.cs
示例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);
}
开发者ID:rajmannartech,项目名称:azure-web-storage-explorer,代码行数:16,代码来源:StorageRepository.cs
示例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;
}
开发者ID:savamura,项目名称:Journalist,代码行数:17,代码来源:CloudTableSegmentedQuery.cs
示例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 );
}
开发者ID:TechSmith,项目名称:hyde,代码行数:18,代码来源:SaveAtomicallyTest.cs
示例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);
});
}
开发者ID:dtretyakov,项目名称:WindowsAzure,代码行数:32,代码来源:CloudTableClientExtensions.cs
示例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;
}
开发者ID:ConnorMcMahon,项目名称:azure-webjobs-sdk,代码行数:19,代码来源:Utility.cs
示例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;
}
开发者ID:skovborg,项目名称:geek-retreat-workshop,代码行数:19,代码来源:TweetFactory.cs
示例16: SerializeToken
public static string SerializeToken(TableContinuationToken token)
{
if (token == null)
{
return null;
}
using (var writer = new StringWriter(CultureInfo.InvariantCulture))
{
using (var xmlWriter = XmlWriter.Create(writer))
{
token.WriteXml(xmlWriter);
}
string serialized = writer.ToString();
var val = EncodeBase64(serialized);
return val;
}
}
开发者ID:ConnorMcMahon,项目名称:azure-webjobs-sdk,代码行数:20,代码来源:Utility.cs
示例17: GetData
private async Task<TableQuerySegment<DynamicTableEntity>> GetData(string tableName, string filter, TableContinuationToken continuationToken)
{
var table = tableClient.GetTableReference(tableName);
if (!table.Exists())
{
throw new ArgumentException("Table does not exist", tableName);
}
var query = new TableQuery<DynamicTableEntity>();
if (!String.IsNullOrEmpty(filter))
{
query = query.Where(filter);
}
if (continuationToken != null)
{
continuationToken.NextTableName = tableName;
}
return await table.ExecuteQuerySegmentedAsync(query, continuationToken);
}
开发者ID:rajmannartech,项目名称:azure-web-storage-explorer,代码行数:20,代码来源:StorageRepository.cs
示例18: Get
public HttpResponseMessage Get([FromUri]EventFilter filter, string NextPartitionKey = null, string NextRowKey = null)
{
TableContinuationToken token = null;
if (!String.IsNullOrEmpty(NextPartitionKey) && !String.IsNullOrEmpty(NextRowKey))
{
token = new TableContinuationToken();
token.NextRowKey = NextRowKey;
token.NextPartitionKey = NextPartitionKey;
token.TargetLocation = Microsoft.WindowsAzure.Storage.StorageLocation.Primary;
}
var values = dataConnector.GetEvents(token,filter);
var response = Request.CreateResponse(HttpStatusCode.OK, values);
//add continuation token to header
if (values.ContinuationToken != null && !String.IsNullOrEmpty(values.ContinuationToken.NextPartitionKey) && !String.IsNullOrEmpty(values.ContinuationToken.NextRowKey))
{
response.Headers.Add("x-ms-continuation-NextPartitionKey", values.ContinuationToken.NextPartitionKey);
response.Headers.Add("x-ms-continuation-NextRowKey", values.ContinuationToken.NextRowKey);
}
return response;
}
开发者ID:thomasjetzinger,项目名称:smarthomecloud,代码行数:22,代码来源:EventController.cs
示例19: List
public ActionResult List(string pk, string rk)
{
var storageAccount = CloudStorageAccount.Parse(_storageConnection);
var tableClient = storageAccount.CreateCloudTableClient();
var table = tableClient.GetTableReference("SlabLogsTable");
if (!table.Exists())
return HttpNotFound();
var query = (from ent in table.CreateQuery<SlabLogsTable>()
select ent)
.Take(100)
.AsTableQuery();
TableContinuationToken token = null;
if (!string.IsNullOrEmpty(pk) && !string.IsNullOrEmpty(rk))
token = new TableContinuationToken() { NextPartitionKey = pk, NextRowKey = rk };
var queryResult = query.ExecuteSegmented(token);
var results = queryResult
.ToList()
.OrderByDescending(i => i.EventDate); // added to handle issue when rowkey not deterministic across apps
if (queryResult.ContinuationToken != null)
{
ViewBag.HasNextPage = true;
ViewBag.NextPartitionKey = queryResult.ContinuationToken.NextPartitionKey;
ViewBag.NextRowKey = queryResult.ContinuationToken.NextRowKey;
}
else
ViewBag.HasNextPage = false;
return View(results);
}
开发者ID:paulirwin,项目名称:AzureSLABViewer,代码行数:38,代码来源:LogController.cs
示例20: QueryImpl
private static RESTCommand<TableQuerySegment> QueryImpl(TableQuery query, TableContinuationToken token, CloudTableClient client, string tableName, TableRequestOptions requestOptions)
{
Uri tempUri = NavigationHelper.AppendPathToUri(client.BaseUri, tableName);
UriQueryBuilder builder = query.GenerateQueryBuilder();
if (token != null)
{
token.ApplyToUriQueryBuilder(builder);
}
Uri reqUri = builder.AddToUri(tempUri);
RESTCommand<TableQuerySegment> queryCmd = new RESTCommand<TableQuerySegment>(client.Credentials, reqUri);
queryCmd.ApplyRequestOptions(requestOptions);
queryCmd.RetrieveResponseStream = true;
queryCmd.Handler = client.AuthenticationHandler;
queryCmd.BuildClient = HttpClientFactory.BuildHttpClient;
queryCmd.BuildRequest = (cmd, cnt, ctx) => TableOperationHttpRequestMessageFactory.BuildRequestForTableQuery(cmd.Uri, cmd.ServerTimeoutInSeconds, ctx);
queryCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp.StatusCode, null /* retVal */, cmd, ex);
queryCmd.PostProcessResponse = (cmd, resp, ctx) => TableOperationHttpResponseParsers.TableQueryPostProcess(cmd.ResponseStream, resp, ctx);
return queryCmd;
}
开发者ID:huoxudong125,项目名称:azure-sdk-for-net,代码行数:24,代码来源:TableQuery.cs
注:本文中的Microsoft.WindowsAzure.Storage.Table.TableContinuationToken类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论