本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Core.UriQueryBuilder.Add方法的典型用法代码示例。如果您正苦于以下问题:C# UriQueryBuilder.Add方法的具体用法?C# UriQueryBuilder.Add怎么用?C# UriQueryBuilder.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.WindowsAzure.Storage.Core.UriQueryBuilder
的用法示例。
在下文中一共展示了UriQueryBuilder.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AppendBlock
/// <summary>
/// Constructs a web request to commit a block to an append blob.
/// </summary>
/// <param name="uri">A <see cref="System.Uri"/> specifying the absolute URI to the blob.</param>
/// <param name="timeout">An integer specifying the server timeout interval.</param>
/// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the condition that must be met in order for the request to proceed.</param>
/// <param name="content"> The HTTP entity body and content headers.</param>
/// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
/// <returns>A <see cref="System.Net.HttpWebRequest"/> object.</returns>
public static HttpRequestMessage AppendBlock(Uri uri, int? timeout, AccessCondition accessCondition, HttpContent content, OperationContext operationContext)
{
UriQueryBuilder builder = new UriQueryBuilder();
builder.Add(Constants.QueryConstants.Component, "appendblock");
HttpRequestMessage request = HttpRequestMessageFactory.CreateRequestMessage(HttpMethod.Put, uri, timeout, builder, content, operationContext);
request.ApplyAccessCondition(accessCondition);
request.ApplyAppendCondition(accessCondition);
return request;
}
示例2: BuildRequestCore
internal static HttpRequestMessage BuildRequestCore(Uri uri, HttpMethod method, int? timeout, OperationContext ctx)
{
Uri uriRequest = uri;
if (timeout != null && timeout != 0)
{
UriQueryBuilder builder = new UriQueryBuilder();
builder.Add("timeout", timeout.ToString());
uriRequest = builder.AddToUri(uri);
}
HttpRequestMessage msg = new HttpRequestMessage(method, uriRequest);
msg.Headers.Add("Accept", "application/atom+xml,application/xml");
msg.Headers.Add("Accept-Charset", "UTF-8");
msg.Headers.Add("MaxDataServiceVersion", "2.0;NetFx");
return msg;
}
示例3: Resize
/// Constructs a web request to set system properties for a file.
/// </summary>
/// <param name="uri">The absolute URI to the file.</param>
/// <param name="timeout">The server timeout interval.</param>
/// <param name="newFileSize">The new file size. Set this parameter to <c>null</c> to keep the existing file size.</param>
/// <param name="accessCondition">The access condition to apply to the request.</param>
/// <returns>A web request to use to perform the operation.</returns>
public static StorageRequestMessage Resize(Uri uri, int? timeout, long newFileSize, AccessCondition accessCondition, HttpContent content, OperationContext operationContext, ICanonicalizer canonicalizer, StorageCredentials credentials)
{
UriQueryBuilder builder = new UriQueryBuilder();
builder.Add(Constants.QueryConstants.Component, "properties");
StorageRequestMessage request = HttpRequestMessageFactory.CreateRequestMessage(HttpMethod.Put, uri, timeout, builder, content, operationContext, canonicalizer, credentials);
request.Headers.Add(Constants.HeaderConstants.FileContentLengthHeader, newFileSize.ToString(NumberFormatInfo.InvariantInfo));
request.ApplyAccessCondition(accessCondition);
return request;
}
示例4: Snapshot
/// <summary>
/// Constructs a web request to create a snapshot of a blob.
/// </summary>
/// <param name="uri">A <see cref="System.Uri"/> specifying the absolute URI to the blob.</param>
/// <param name="timeout">An integer specifying the server timeout interval.</param>
/// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the condition that must be met in order for the request to proceed.</param>
/// <param name="useVersionHeader">A boolean value indicating whether to set the <i>x-ms-version</i> HTTP header.</param>
/// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
/// <returns>A <see cref="System.Net.HttpWebRequest"/> object.</returns>
public static HttpWebRequest Snapshot(Uri uri, int? timeout, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)
{
UriQueryBuilder builder = new UriQueryBuilder();
builder.Add(Constants.QueryConstants.Component, "snapshot");
HttpWebRequest request = HttpWebRequestFactory.CreateWebRequest(WebRequestMethods.Http.Put, uri, timeout, builder, useVersionHeader, operationContext);
request.ApplyAccessCondition(accessCondition);
return request;
}
示例5: PeekMessages
/// <summary>
/// Constructs a web request to peek messages for a queue.
/// </summary>
/// <param name="uri">The absolute URI to the queue.</param>
/// <param name="timeout">The server timeout interval.</param>
/// <returns>A web request to use to perform the operation.</returns>
public static HttpRequestMessage PeekMessages(Uri uri, int? timeout, int numberOfMessages, HttpContent content, OperationContext operationContext)
{
UriQueryBuilder builder = new UriQueryBuilder();
builder.Add(Constants.HeaderConstants.PeekOnly, Constants.HeaderConstants.TrueHeader);
builder.Add(Constants.QueryConstants.NumOfMessages, numberOfMessages.ToString());
HttpRequestMessage request = HttpRequestMessageFactory.CreateRequestMessage(HttpMethod.Get, uri, timeout, builder, content, operationContext);
return request;
}
示例6: GenerateQueryBuilder
internal UriQueryBuilder GenerateQueryBuilder()
{
UriQueryBuilder builder = new UriQueryBuilder();
// filter
if (!string.IsNullOrEmpty(this.FilterString))
{
builder.Add(TableConstants.Filter, this.FilterString);
}
// take
if (this.takeCount.HasValue)
{
builder.Add(TableConstants.Top, Convert.ToString(Math.Min(this.takeCount.Value, TableConstants.TableServiceMaxResults)));
}
// select
if (this.SelectColumns != null && this.SelectColumns.Count > 0)
{
StringBuilder colBuilder = new StringBuilder();
bool foundRk = false;
bool foundPk = false;
bool foundTs = false;
for (int m = 0; m < this.SelectColumns.Count; m++)
{
if (this.SelectColumns[m] == TableConstants.PartitionKey)
{
foundPk = true;
}
else if (this.SelectColumns[m] == TableConstants.RowKey)
{
foundRk = true;
}
else if (this.SelectColumns[m] == TableConstants.Timestamp)
{
foundTs = true;
}
colBuilder.Append(this.SelectColumns[m]);
if (m < this.SelectColumns.Count - 1)
{
colBuilder.Append(",");
}
}
if (!foundPk)
{
colBuilder.Append(",");
colBuilder.Append(TableConstants.PartitionKey);
}
if (!foundRk)
{
colBuilder.Append(",");
colBuilder.Append(TableConstants.RowKey);
}
if (!foundTs)
{
colBuilder.Append(",");
colBuilder.Append(TableConstants.Timestamp);
}
builder.Add(TableConstants.Select, colBuilder.ToString());
}
return builder;
}
示例7: List
/// <summary>
/// Constructs a web request to return a listing of all containers in this storage account.
/// </summary>
/// <param name="uri">A <see cref="System.Uri"/> specifying the Blob service endpoint.</param>
/// <param name="timeout">An integer specifying the server timeout interval.</param>
/// <param name="listingContext">A <see cref="ListingContext"/> object.</param>
/// <param name="detailsIncluded">A <see cref="ContainerListingDetails"/> enumeration value that indicates whether to return container metadata with the listing.</param>
/// <param name="useVersionHeader">A boolean value indicating whether to set the <i>x-ms-version</i> HTTP header.</param>
/// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
/// <returns>A web request for the specified operation.</returns>
public static HttpWebRequest List(Uri uri, int? timeout, ListingContext listingContext, ContainerListingDetails detailsIncluded, bool useVersionHeader, OperationContext operationContext)
{
UriQueryBuilder builder = new UriQueryBuilder();
builder.Add(Constants.QueryConstants.Component, "list");
if (listingContext != null)
{
if (listingContext.Prefix != null)
{
builder.Add("prefix", listingContext.Prefix);
}
if (listingContext.Marker != null)
{
builder.Add("marker", listingContext.Marker);
}
if (listingContext.MaxResults.HasValue)
{
builder.Add("maxresults", listingContext.MaxResults.ToString());
}
}
if ((detailsIncluded & ContainerListingDetails.Metadata) != 0)
{
builder.Add("include", "metadata");
}
HttpWebRequest request = HttpWebRequestFactory.CreateWebRequest(WebRequestMethods.Http.Get, uri, timeout, builder, useVersionHeader, operationContext);
return request;
}
示例8: DeleteMessage
/// <summary>
/// Constructs a web request to update a message.
/// </summary>
/// <param name="uri">A <see cref="System.Uri"/> specifying the absolute URI to the message to update.</param>
/// <param name="timeout">The server timeout interval, in seconds.</param>
/// <param name="popReceipt">A string specifying the pop receipt of the message.</param>
/// <param name="useVersionHeader">A flag indicating whether to set the x-ms-version HTTP header.</param>
/// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
/// <returns>A <see cref="System.Net.HttpWebRequest"/> object.</returns>
public static HttpWebRequest DeleteMessage(Uri uri, int? timeout, string popReceipt, bool useVersionHeader, OperationContext operationContext)
{
UriQueryBuilder builder = new UriQueryBuilder();
builder.Add(Constants.QueryConstants.PopReceipt, popReceipt);
HttpWebRequest request = HttpWebRequestFactory.Delete(uri, builder, timeout, useVersionHeader, operationContext);
return request;
}
示例9: PeekMessages
/// <summary>
/// Constructs a web request to peek messages from a queue.
/// </summary>
/// <param name="uri">A <see cref="System.Uri"/> specifying the absolute URI to the queue.</param>
/// <param name="timeout">An integer specifying the server timeout interval.</param>
/// <param name="numberOfMessages">An integer specifying the number of messages to peek.</param>
/// <param name="useVersionHeader">A flag indicating whether to set the x-ms-version HTTP header.</param>
/// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
/// <returns>A <see cref="System.Net.HttpWebRequest"/> object.</returns>
public static HttpWebRequest PeekMessages(Uri uri, int? timeout, int numberOfMessages, bool useVersionHeader, OperationContext operationContext)
{
UriQueryBuilder builder = new UriQueryBuilder();
builder.Add(Constants.HeaderConstants.PeekOnly, Constants.HeaderConstants.TrueHeader);
builder.Add(Constants.QueryConstants.NumOfMessages, numberOfMessages.ToString(CultureInfo.InvariantCulture));
HttpWebRequest request = HttpWebRequestFactory.CreateWebRequest(WebRequestMethods.Http.Get, uri, timeout, builder, useVersionHeader, operationContext);
return request;
}
示例10: SourceBlobToUri
/// <summary>
/// Converts the source blob of a copy operation to an appropriate access URI, taking Shared Access Signature credentials into account.
/// </summary>
/// <param name="source">The source blob.</param>
/// <returns>A URI addressing the source blob, using SAS if appropriate.</returns>
internal static Uri SourceBlobToUri(ICloudBlob source)
{
Uri sourceUri = source.ServiceClient.Credentials.TransformUri(source.Uri);
if (source.SnapshotTime.HasValue)
{
UriQueryBuilder builder = new UriQueryBuilder();
builder.Add("snapshot", BlobRequest.ConvertDateTimeToSnapshotString(source.SnapshotTime.Value));
sourceUri = builder.AddToUri(sourceUri);
}
return sourceUri;
}
示例11: AddMessage
/// <summary>
/// Constructs a web request to add a message for a queue.
/// </summary>
/// <param name="uri">A <see cref="System.Uri"/> specifying the absolute URI to the queue.</param>
/// <param name="timeout">An integer specifying the server timeout interval.</param>
/// <param name="timeToLiveInSeconds">The message time-to-live, in seconds.</param>
/// <param name="visibilityTimeoutInSeconds">The length of time during which the message will be invisible, in seconds.</param>
/// <param name="useVersionHeader">A flag indicating whether to set the x-ms-version HTTP header.</param>
/// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
/// <returns>A <see cref="System.Net.HttpWebRequest"/> object.</returns>
public static HttpWebRequest AddMessage(Uri uri, int? timeout, int? timeToLiveInSeconds, int? visibilityTimeoutInSeconds, bool useVersionHeader, OperationContext operationContext)
{
UriQueryBuilder builder = new UriQueryBuilder();
if (timeToLiveInSeconds != null)
{
builder.Add(Constants.QueryConstants.MessageTimeToLive, timeToLiveInSeconds.Value.ToString(CultureInfo.InvariantCulture));
}
if (visibilityTimeoutInSeconds != null)
{
builder.Add(Constants.QueryConstants.VisibilityTimeout, visibilityTimeoutInSeconds.Value.ToString(CultureInfo.InvariantCulture));
}
HttpWebRequest request = HttpWebRequestFactory.CreateWebRequest(WebRequestMethods.Http.Post, uri, timeout, builder, useVersionHeader, operationContext);
return request;
}
示例12: ListRanges
/// <summary>
/// Constructs a web request to return the list of valid ranges for a file.
/// </summary>
/// <param name="uri">The absolute URI to the file.</param>
/// <param name="timeout">The server timeout interval.</param>
/// <param name="offset">The starting offset of the data range over which to list file ranges, in bytes.</param>
/// <param name="count">The length of the data range over which to list file ranges, in bytes.</param>
/// <param name="accessCondition">The access condition to apply to the request.</param>
/// <returns>A web request to use to perform the operation.</returns>
public static StorageRequestMessage ListRanges(Uri uri, int? timeout, long? offset, long? count, AccessCondition accessCondition, HttpContent content, OperationContext operationContext, ICanonicalizer canonicalizer, StorageCredentials credentials)
{
if (offset.HasValue)
{
CommonUtility.AssertNotNull("count", count);
}
UriQueryBuilder builder = new UriQueryBuilder();
builder.Add(Constants.QueryConstants.Component, "rangelist");
StorageRequestMessage request = HttpRequestMessageFactory.CreateRequestMessage(HttpMethod.Get, uri, timeout, builder, content, operationContext, canonicalizer, credentials);
AddRange(request, offset, count);
request.ApplyAccessCondition(accessCondition);
return request;
}
示例13: SetProperties
/// <summary>
/// Constructs a web request to set system properties for a file.
/// </summary>
/// <param name="uri">The absolute URI to the file.</param>
/// <param name="timeout">The server timeout interval.</param>
/// <param name="properties">The file's properties.</param>
/// <param name="accessCondition">The access condition to apply to the request.</param>
/// <returns>A web request to use to perform the operation.</returns>
public static StorageRequestMessage SetProperties(Uri uri, int? timeout, FileProperties properties, AccessCondition accessCondition, HttpContent content, OperationContext operationContext, ICanonicalizer canonicalizer, StorageCredentials credentials)
{
UriQueryBuilder builder = new UriQueryBuilder();
builder.Add(Constants.QueryConstants.Component, "properties");
StorageRequestMessage request = HttpRequestMessageFactory.CreateRequestMessage(HttpMethod.Put, uri, timeout, builder, content, operationContext, canonicalizer, credentials);
if (properties != null)
{
request.AddOptionalHeader(Constants.HeaderConstants.FileCacheControlHeader, properties.CacheControl);
request.AddOptionalHeader(Constants.HeaderConstants.FileContentDispositionRequestHeader, properties.ContentDisposition);
request.AddOptionalHeader(Constants.HeaderConstants.FileContentEncodingHeader, properties.ContentEncoding);
request.AddOptionalHeader(Constants.HeaderConstants.FileContentLanguageHeader, properties.ContentLanguage);
request.AddOptionalHeader(Constants.HeaderConstants.FileContentMD5Header, properties.ContentMD5);
request.AddOptionalHeader(Constants.HeaderConstants.FileContentTypeHeader, properties.ContentType);
}
request.ApplyAccessCondition(accessCondition);
return request;
}
示例14: PutPage
/// <summary>
/// Constructs a web request to write or clear a range of pages in a page blob.
/// </summary>
/// <param name="uri">A <see cref="System.Uri"/> specifying the absolute URI to the blob.</param>
/// <param name="timeout">An integer specifying the server timeout interval.</param>
/// <param name="pageRange">A <see cref="PageRange"/> object.</param>
/// <param name="pageWrite">A <see cref="PageWrite"/> enumeration value indicating the operation to perform on the page blob.</param>
/// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the condition that must be met in order for the request to proceed.</param>
/// <param name="useVersionHeader">A boolean value indicating whether to set the <i>x-ms-version</i> HTTP header.</param>
/// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
/// <returns>
/// A web request to use to perform the operation.
/// </returns>
public static HttpWebRequest PutPage(Uri uri, int? timeout, PageRange pageRange, PageWrite pageWrite, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)
{
CommonUtility.AssertNotNull("pageRange", pageRange);
UriQueryBuilder builder = new UriQueryBuilder();
builder.Add(Constants.QueryConstants.Component, "page");
HttpWebRequest request = HttpWebRequestFactory.CreateWebRequest(WebRequestMethods.Http.Put, uri, timeout, builder, useVersionHeader, operationContext);
request.Headers.Add(Constants.HeaderConstants.RangeHeader, pageRange.ToString());
request.Headers.Add(Constants.HeaderConstants.PageWrite, pageWrite.ToString());
request.ApplyAccessCondition(accessCondition);
request.ApplySequenceNumberCondition(accessCondition);
return request;
}
示例15: GetBlockList
/// <summary>
/// Constructs a web request to return the list of blocks for a block blob.
/// </summary>
/// <param name="uri">A <see cref="System.Uri"/> specifying the absolute URI to the blob.</param>
/// <param name="timeout">An integer specifying the server timeout interval.</param>
/// <param name="snapshot">A <see cref="DateTimeOffset"/> specifying the snapshot timestamp, if the blob is a snapshot.</param>
/// <param name="typesOfBlocks">A <see cref="BlockListingFilter"/> enumeration value.</param>
/// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the condition that must be met in order for the request to proceed.</param>
/// <param name="useVersionHeader">A boolean value indicating whether to set the <i>x-ms-version</i> HTTP header.</param>
/// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
/// <returns>A <see cref="System.Net.HttpWebRequest"/> object.</returns>
public static HttpWebRequest GetBlockList(Uri uri, int? timeout, DateTimeOffset? snapshot, BlockListingFilter typesOfBlocks, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)
{
UriQueryBuilder builder = new UriQueryBuilder();
builder.Add(Constants.QueryConstants.Component, "blocklist");
builder.Add("blocklisttype", typesOfBlocks.ToString());
BlobHttpWebRequestFactory.AddSnapshot(builder, snapshot);
HttpWebRequest request = HttpWebRequestFactory.CreateWebRequest(WebRequestMethods.Http.Get, uri, timeout, builder, useVersionHeader, operationContext);
request.ApplyAccessCondition(accessCondition);
return request;
}