本文整理汇总了C#中QueueContinuationToken类的典型用法代码示例。如果您正苦于以下问题:C# QueueContinuationToken类的具体用法?C# QueueContinuationToken怎么用?C# QueueContinuationToken使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QueueContinuationToken类属于命名空间,在下文中一共展示了QueueContinuationToken类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ListQueuesSegmentedAsync
public Task<QueueResultSegment> ListQueuesSegmentedAsync(string prefix, QueueContinuationToken currentToken)
{
return this.ListQueuesSegmentedAsync(prefix, currentToken, CancellationToken.None);
}
示例2: BeginListQueuesSegmented
/// <summary>
/// Begins an asynchronous operation to return a result segment containing a collection of queue items.
/// </summary>
/// <param name="prefix">The queue name prefix.</param>
/// <param name="currentToken">A <see cref="QueueContinuationToken"/> returned by a previous listing operation.</param>
/// <param name="callback">The callback delegate that will receive notification when the asynchronous operation completes.</param>
/// <param name="state">A user-defined object that will be passed to the callback delegate.</param>
/// <returns>An <see cref="ICancellableAsyncResult"/> that references the asynchronous operation.</returns>
public ICancellableAsyncResult BeginListQueuesSegmented(string prefix, QueueContinuationToken currentToken, AsyncCallback callback, object state)
{
return this.BeginListQueuesSegmented(prefix, QueueListingDetails.None, null, currentToken, null, null, callback, state);
}
示例3: ListQueuesSegmentedAsync
/// <summary>
/// Returns a result segment containing a collection of queues.
/// </summary>
/// <param name="currentToken">A <see cref="QueueContinuationToken"/> token returned by a previous listing operation.</param>
/// <returns>A result segment of queues.</returns>
public IAsyncOperation<QueueResultSegment> ListQueuesSegmentedAsync(QueueContinuationToken currentToken)
{
return this.ListQueuesSegmentedAsync(null, QueueListingDetails.None, 0, currentToken, null);
}
示例4: ListQueuesSegmentedAsync
/// <summary>
/// Returns a result segment containing a collection of queues.
/// </summary>
/// <param name="currentToken">A <see cref="QueueContinuationToken"/> token returned by a previous listing operation.</param>
/// <returns>A result segment of queues.</returns>
#if ASPNET_K || PORTABLE
public Task<QueueResultSegment> ListQueuesSegmentedAsync(QueueContinuationToken currentToken)
示例5: QueueResultSegment
internal QueueResultSegment(IEnumerable<CloudQueue> queues, QueueContinuationToken continuationToken)
{
this.Results = queues;
this.ContinuationToken = continuationToken;
}
示例6: ListQueuesSegmented
/// <summary>
/// Returns a result segment containing a collection of queues.
/// </summary>
/// <param name="currentToken">A <see cref="QueueContinuationToken"/> continuation token returned by a previous listing operation.</param>
/// <returns>A <see cref="QueueResultSegment"/> object.</returns>
public virtual QueueResultSegment ListQueuesSegmented(QueueContinuationToken currentToken)
{
return this.ListQueuesSegmented(null, QueueListingDetails.None, null, currentToken, null, null);
}
示例7: ListQueuesSegmentedAsync
public virtual Task<QueueResultSegment> ListQueuesSegmentedAsync(QueueContinuationToken currentToken)
{
return this.ListQueuesSegmentedAsync(currentToken, CancellationToken.None);
}
示例8: QueueContinuationTokenVerifySerializer
public void QueueContinuationTokenVerifySerializer()
{
XmlSerializer serializer = new XmlSerializer(typeof(QueueContinuationToken));
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
StringReader reader;
string tokenxml;
QueueContinuationToken writeToken = new QueueContinuationToken
{
NextMarker = Guid.NewGuid().ToString(),
TargetLocation = StorageLocation.Primary
};
QueueContinuationToken readToken = null;
// Write with XmlSerializer
using (StringWriter writer = new StringWriter())
{
serializer.Serialize(writer, writeToken);
tokenxml = writer.ToString();
}
// Read with XmlSerializer
reader = new StringReader(tokenxml);
readToken = (QueueContinuationToken)serializer.Deserialize(reader);
Assert.AreEqual(writeToken.NextMarker, readToken.NextMarker);
// Read with token.ReadXml()
using (XmlReader xmlReader = XmlReader.Create(new StringReader(tokenxml)))
{
readToken = new QueueContinuationToken();
readToken.ReadXml(xmlReader);
}
Assert.AreEqual(writeToken.NextMarker, readToken.NextMarker);
// Read with token.ReadXml()
using (XmlReader xmlReader = XmlReader.Create(new StringReader(tokenxml)))
{
readToken = new QueueContinuationToken();
readToken.ReadXml(xmlReader);
}
// Write with token.WriteXml
StringBuilder sb = new StringBuilder();
using (XmlWriter writer = XmlWriter.Create(sb, settings))
{
writeToken.WriteXml(writer);
}
// Read with XmlSerializer
reader = new StringReader(sb.ToString());
readToken = (QueueContinuationToken)serializer.Deserialize(reader);
Assert.AreEqual(writeToken.NextMarker, readToken.NextMarker);
// Read with token.ReadXml()
using (XmlReader xmlReader = XmlReader.Create(new StringReader(sb.ToString())))
{
readToken = new QueueContinuationToken();
readToken.ReadXml(xmlReader);
}
Assert.AreEqual(writeToken.NextMarker, readToken.NextMarker);
}
示例9: QueueContinuationTokenVerifyXmlWithinXml
public void QueueContinuationTokenVerifyXmlWithinXml()
{
CloudQueueClient client = GenerateCloudQueueClient();
string prefix = "dotnetqueuetest" + Guid.NewGuid().ToString("N");
List<string> queueNames = new List<string>();
int count = 30;
for (int i = 0; i < count; i++)
{
queueNames.Add(prefix + i);
client.GetQueueReference(prefix + i).Create();
}
QueueContinuationToken token = null;
List<CloudQueue> results = new List<CloudQueue>();
do
{
QueueResultSegment segment = client.ListQueuesSegmented(prefix, QueueListingDetails.None, 5, token, null, null);
token = segment.ContinuationToken;
results.AddRange(segment.Results);
if (token != null)
{
Assert.AreEqual(null, token.GetSchema());
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
StringBuilder sb = new StringBuilder();
using (XmlWriter writer = XmlWriter.Create(sb, settings))
{
writer.WriteStartElement("test1");
writer.WriteStartElement("test2");
token.WriteXml(writer);
writer.WriteEndElement();
writer.WriteEndElement();
}
using (XmlReader reader = XmlReader.Create(new StringReader(sb.ToString())))
{
token = new QueueContinuationToken();
reader.ReadStartElement();
reader.ReadStartElement();
token.ReadXml(reader);
reader.ReadEndElement();
reader.ReadEndElement();
}
}
}
while (token != null);
foreach (CloudQueue queue in results)
{
if (queueNames.Remove(queue.Name))
{
queue.Delete();
}
else
{
Assert.Fail();
}
}
Assert.AreEqual<int>(0, queueNames.Count);
}
示例10: ListQueuesSegmentedAsync
public virtual Task<QueueResultSegment> ListQueuesSegmentedAsync(string prefix, QueueContinuationToken currentToken)
{
return this.ListQueuesSegmentedAsync(prefix, QueueListingDetails.None, null, currentToken, null, null);
}
示例11: ListQueuesImpl
/// <summary>
/// Core implementation for the ListQueues method.
/// </summary>
/// <param name="prefix">The queue prefix.</param>
/// <param name="detailsIncluded">The details included.</param>
/// <param name="currentToken">The continuation token.</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 <c>null</c>, the maximum possible number of results will be returned, up to 5000.</param>
/// <returns>A <see cref="TaskSequence"/> that lists the queues.</returns>
private RESTCommand<ResultSegment<CloudQueue>> ListQueuesImpl(string prefix, int? maxResults, QueueListingDetails detailsIncluded, QueueRequestOptions options, QueueContinuationToken currentToken)
{
ListingContext listingContext = new ListingContext(prefix, maxResults)
{
Marker = currentToken != null ? currentToken.NextMarker : null
};
RESTCommand<ResultSegment<CloudQueue>> getCmd = new RESTCommand<ResultSegment<CloudQueue>>(this.Credentials, this.StorageUri);
options.ApplyToStorageCommand(getCmd);
getCmd.CommandLocationMode = CommonUtility.GetListingLocationMode(currentToken);
getCmd.RetrieveResponseStream = true;
getCmd.BuildRequest = (cmd, uri, builder, cnt, serverTimeout, ctx) => QueueHttpRequestMessageFactory.List(uri, serverTimeout, listingContext, detailsIncluded, cnt, ctx, this.GetCanonicalizer(), this.Credentials);
getCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null /* retVal */, cmd, ex);
getCmd.PostProcessResponse = (cmd, resp, ctx) =>
{
return Task.Factory.StartNew(() =>
{
ListQueuesResponse listQueuesResponse = new ListQueuesResponse(cmd.ResponseStream);
List<CloudQueue> queuesList = listQueuesResponse.Queues.Select(item => new CloudQueue(item.Metadata, item.Name, this)).ToList();
QueueContinuationToken continuationToken = null;
if (listQueuesResponse.NextMarker != null)
{
continuationToken = new QueueContinuationToken()
{
NextMarker = listQueuesResponse.NextMarker,
TargetLocation = cmd.CurrentResult.TargetLocation,
};
}
return new ResultSegment<CloudQueue>(queuesList)
{
ContinuationToken = continuationToken,
};
});
};
return getCmd;
}
示例12: QueueContinuationTokenVerifyEmptyTargetDeserializer
public void QueueContinuationTokenVerifyEmptyTargetDeserializer()
{
QueueContinuationToken queueContinuationToken = new QueueContinuationToken { TargetLocation = null };
StringBuilder stringBuilder = new StringBuilder();
using (XmlWriter writer = XmlWriter.Create(stringBuilder))
{
queueContinuationToken.WriteXml(writer);
}
string stringToken = stringBuilder.ToString();
QueueContinuationToken parsedToken = new QueueContinuationToken();
parsedToken.ReadXml(XmlReader.Create(new System.IO.StringReader(stringToken)));
Assert.AreEqual(parsedToken.TargetLocation, null);
}
示例13: ListQueuesSegmentedAsync
/// <summary>
/// Returns a result segment containing a collection of queues
/// whose names begin with the specified prefix.
/// </summary>
/// <param name="prefix">The queue name prefix.</param>
/// <param name="detailsIncluded">A value that indicates whether to return queue metadata with the listing.</param>
/// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned
/// in the result segment, up to the per-operation limit of 5000. If this value is <c>null</c>, the maximum possible number of results will be returned, up to 5000.</param>
/// <param name="currentToken">A <see cref="QueueContinuationToken"/> token returned by a previous listing operation.</param>
/// <param name="options">An object that specifies additional options for the request.</param>
/// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
/// <returns>A result segment of queues.</returns>
public IAsyncOperation<QueueResultSegment> ListQueuesSegmentedAsync(string prefix, QueueListingDetails detailsIncluded, int? maxResults, QueueContinuationToken currentToken, QueueRequestOptions options, OperationContext operationContext)
{
QueueRequestOptions modifiedOptions = QueueRequestOptions.ApplyDefaults(options, this);
operationContext = operationContext ?? new OperationContext();
return AsyncInfo.Run(async (token) =>
{
ResultSegment<CloudQueue> resultSegment = await Executor.ExecuteAsync(
this.ListQueuesImpl(prefix, maxResults, detailsIncluded, modifiedOptions, currentToken),
this.RetryPolicy,
operationContext,
token);
return new QueueResultSegment(resultSegment.Results, (QueueContinuationToken)resultSegment.ContinuationToken);
});
}
示例14: ListQueuesSegmented
/// <summary>
/// Returns a result segment containing a collection of queues in the storage account.
/// </summary>
/// <param name="prefix">The queue name prefix.</param>
/// <param name="currentToken">A <see cref="QueueContinuationToken"/> continuation token returned by a previous listing operation.</param>
/// <returns>A result segment containing objects that implement <see cref="CloudQueue"/>.</returns>
public QueueResultSegment ListQueuesSegmented(string prefix, QueueContinuationToken currentToken)
{
return this.ListQueuesSegmented(prefix, QueueListingDetails.None, null, currentToken, null, null);
}
示例15: ListQueuesImpl
/// <summary>
/// Core implementation of the ListQueues method.
/// </summary>
/// <param name="prefix">The queue 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 <c>null</c>, the maximum possible number of results will be returned, up to 5000.</param>
/// <param name="queueListingDetails">A <see cref="QueueListingDetails"/> enumeration describing which items to include in the listing.</param>
/// <param name="options">An object that specifies additional options for the request.</param>
/// <param name="currentToken">The continuation token.</param>
/// <returns>A <see cref="RESTCommand{T}"/> that lists the queues.</returns>
private RESTCommand<ResultSegment<CloudQueue>> ListQueuesImpl(string prefix, int? maxResults, QueueListingDetails queueListingDetails, QueueRequestOptions options, QueueContinuationToken currentToken)
{
QueueListingContext listingContext = new QueueListingContext(prefix, maxResults, queueListingDetails)
{
Marker = currentToken != null ? currentToken.NextMarker : null
};
RESTCommand<ResultSegment<CloudQueue>> getCmd = new RESTCommand<ResultSegment<CloudQueue>>(this.Credentials, this.BaseUri);
getCmd.ApplyRequestOptions(options);
getCmd.RetrieveResponseStream = true;
getCmd.BuildRequestDelegate = (uri, builder, serverTimeout, ctx) => QueueHttpWebRequestFactory.List(uri, serverTimeout, listingContext, queueListingDetails, ctx);
getCmd.SignRequest = this.AuthenticationHandler.SignRequest;
getCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null /* retVal */, cmd, ex);
getCmd.PostProcessResponse = (cmd, resp, ctx) =>
{
ListQueuesResponse listQueuesResponse = new ListQueuesResponse(cmd.ResponseStream);
List<CloudQueue> queuesList = new List<CloudQueue>(
listQueuesResponse.Queues.Select(item => new CloudQueue(item.Name, this)));
QueueContinuationToken continuationToken = null;
if (listQueuesResponse.NextMarker != null)
{
continuationToken = new QueueContinuationToken()
{
NextMarker = listQueuesResponse.NextMarker,
};
}
return new ResultSegment<CloudQueue>(queuesList)
{
ContinuationToken = continuationToken,
};
};
return getCmd;
}