本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Queue.QueueRequestOptions.ApplyToStorageCommand方法的典型用法代码示例。如果您正苦于以下问题:C# QueueRequestOptions.ApplyToStorageCommand方法的具体用法?C# QueueRequestOptions.ApplyToStorageCommand怎么用?C# QueueRequestOptions.ApplyToStorageCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.WindowsAzure.Storage.Queue.QueueRequestOptions
的用法示例。
在下文中一共展示了QueueRequestOptions.ApplyToStorageCommand方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPermissionsImpl
/// <summary>
/// Implementation for the GetPermissions method.
/// </summary>
/// <param name="options">A <see cref="QueueRequestOptions"/> object that specifies additional options for the request.</param>
/// <returns>A <see cref="RESTCommand"/> that gets the permissions.</returns>
private RESTCommand<QueuePermissions> GetPermissionsImpl(QueueRequestOptions options)
{
RESTCommand<QueuePermissions> getCmd = new RESTCommand<QueuePermissions>(this.ServiceClient.Credentials, this.StorageUri);
options.ApplyToStorageCommand(getCmd);
getCmd.CommandLocationMode = CommandLocationMode.PrimaryOrSecondary;
getCmd.RetrieveResponseStream = true;
getCmd.BuildRequest = (cmd, uri, builder, cnt, serverTimeout, ctx) => QueueHttpRequestMessageFactory.GetAcl(uri, serverTimeout, cnt, ctx, this.ServiceClient.GetCanonicalizer(), this.ServiceClient.Credentials);
getCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null /* retVal */, cmd, ex);
getCmd.PostProcessResponse = (cmd, resp, ctx) =>
{
this.GetMessageCountAndMetadataFromResponse(resp);
return Task<QueuePermissions>.Factory.StartNew(() =>
{
QueuePermissions queueAcl = new QueuePermissions();
QueueHttpResponseParsers.ReadSharedAccessIdentifiers(cmd.ResponseStream, queueAcl);
return queueAcl;
});
};
return getCmd;
}
示例2: UpdateMessageImpl
/// <summary>
/// Implementation for the UpdateMessage method.
/// </summary>
/// <param name="message">The message to update.</param>
/// <param name="visibilityTimeout">The visibility timeout interval.</param>
/// <param name="updateFields">The message update fields.</param>
/// <param name="options">A <see cref="QueueRequestOptions"/> object that specifies any additional options for the request.</param>
/// <returns>A <see cref="RESTCommand"/> that sets the permissions.</returns>
private RESTCommand<NullType> UpdateMessageImpl(CloudQueueMessage message, TimeSpan? visibilityTimeout, MessageUpdateFields updateFields, QueueRequestOptions options)
{
TimeSpan? effectiveVisibilityTimeout = visibilityTimeout;
if ((updateFields & MessageUpdateFields.Visibility) != 0)
{
CommonUtils.AssertNotNull("visibilityTimeout", visibilityTimeout);
}
else
{
effectiveVisibilityTimeout = TimeSpan.FromSeconds(0);
}
Uri messageUri = this.GetIndividualMessageAddress(message.Id);
RESTCommand<NullType> putCmd = new RESTCommand<NullType>(this.ServiceClient.Credentials, messageUri);
options.ApplyToStorageCommand(putCmd);
putCmd.Handler = this.ServiceClient.AuthenticationHandler;
putCmd.BuildClient = HttpClientFactory.BuildHttpClient;
putCmd.BuildRequest = (cmd, cnt, ctx) => QueueHttpRequestMessageFactory.UpdateMessage(cmd.Uri, cmd.ServerTimeoutInSeconds, message.PopReceipt, effectiveVisibilityTimeout, cnt, ctx);
if ((updateFields & MessageUpdateFields.Content) != 0)
{
MemoryStream memoryStream = new MemoryStream();
QueueRequest.WriteMessageContent(message.GetMessageContentForTransfer(this.EncodeMessage), memoryStream);
memoryStream.Seek(0, SeekOrigin.Begin);
putCmd.BuildContent = (cmd, ctx) => HttpContentFactory.BuildContentFromStream(memoryStream, 0, memoryStream.Length, null, cmd, ctx);
}
putCmd.PreProcessResponse = (cmd, resp, ex, ctx) =>
{
HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.NoContent, resp, NullType.Value, cmd, ex, ctx);
GetPopReceiptAndNextVisibleTimeFromResponse(message, resp);
return NullType.Value;
};
return putCmd;
}
示例3: PeekMessagesImpl
/// <summary>
/// Implementation for the PeekMessages method.
/// </summary>
/// <param name="messageCount">The message count.</param>
/// <param name="options">A <see cref="QueueRequestOptions"/> object that specifies any additional options for the request.</param>
/// <returns>A <see cref="RESTCommand"/> that gets the permissions.</returns>
private RESTCommand<IEnumerable<CloudQueueMessage>> PeekMessagesImpl(int messageCount, QueueRequestOptions options)
{
RESTCommand<IEnumerable<CloudQueueMessage>> getCmd = new RESTCommand<IEnumerable<CloudQueueMessage>>(this.ServiceClient.Credentials, this.GetMessageRequestAddress());
options.ApplyToStorageCommand(getCmd);
getCmd.Handler = this.ServiceClient.AuthenticationHandler;
getCmd.BuildClient = HttpClientFactory.BuildHttpClient;
getCmd.RetrieveResponseStream = true;
getCmd.BuildRequest = (cmd, cnt, ctx) => QueueHttpRequestMessageFactory.PeekMessages(getCmd.Uri, getCmd.ServerTimeoutInSeconds, messageCount, cnt, ctx);
getCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null, cmd, ex, ctx);
getCmd.PostProcessResponse = (cmd, resp, ex, ctx) =>
{
return Task.Factory.StartNew(() =>
{
GetMessagesResponse getMessagesResponse = new GetMessagesResponse(cmd.ResponseStream);
IEnumerable<CloudQueueMessage> messagesList = new List<CloudQueueMessage>(
getMessagesResponse.Messages.Select(item => SelectPeekMessageResponse(item)));
return messagesList;
});
};
return getCmd;
}
示例4: SetMetadataImpl
/// <summary>
/// Implementation for the SetMetadata method.
/// </summary>
/// <param name="options">A <see cref="QueueRequestOptions"/> object that specifies any additional options for the request.</param>
/// <returns>A <see cref="RESTCommand"/> that sets the metadata.</returns>
private RESTCommand<NullType> SetMetadataImpl(QueueRequestOptions options)
{
RESTCommand<NullType> putCmd = new RESTCommand<NullType>(this.ServiceClient.Credentials, this.Uri);
options.ApplyToStorageCommand(putCmd);
putCmd.Handler = this.ServiceClient.AuthenticationHandler;
putCmd.BuildClient = HttpClientFactory.BuildHttpClient;
putCmd.BuildRequest = (cmd, cnt, ctx) =>
{
HttpRequestMessage msg = QueueHttpRequestMessageFactory.SetMetadata(cmd.Uri, cmd.ServerTimeoutInSeconds, cnt, ctx);
QueueHttpRequestMessageFactory.AddMetadata(msg, this.Metadata);
return msg;
};
putCmd.PreProcessResponse = (cmd, resp, ex, ctx) =>
{
HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.NoContent, resp, NullType.Value, cmd, ex, ctx);
GetMessageCountAndMetadataFromResponse(resp);
return NullType.Value;
};
return putCmd;
}
示例5: GetPermissionsImpl
/// <summary>
/// Implementation for the GetPermissions method.
/// </summary>
/// <param name="options">A <see cref="QueueRequestOptions"/> object that specifies any additional options for the request.</param>
/// <returns>A <see cref="RESTCommand"/> that gets the permissions.</returns>
private RESTCommand<QueuePermissions> GetPermissionsImpl(QueueRequestOptions options)
{
RESTCommand<QueuePermissions> getCmd = new RESTCommand<QueuePermissions>(this.ServiceClient.Credentials, this.Uri);
options.ApplyToStorageCommand(getCmd);
getCmd.Handler = this.ServiceClient.AuthenticationHandler;
getCmd.BuildClient = HttpClientFactory.BuildHttpClient;
getCmd.RetrieveResponseStream = true;
getCmd.BuildRequest = (cmd, cnt, ctx) => QueueHttpRequestMessageFactory.GetAcl(cmd.Uri, cmd.ServerTimeoutInSeconds, cnt, ctx);
getCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null /* retVal */, cmd, ex, ctx);
getCmd.PostProcessResponse = (cmd, resp, ex, ctx) =>
{
this.GetMessageCountAndMetadataFromResponse(resp);
return Task<QueuePermissions>.Factory.StartNew(() =>
{
QueuePermissions queueAcl = new QueuePermissions();
QueueHttpResponseParsers.ReadSharedAccessIdentifiers(cmd.ResponseStream, queueAcl);
return queueAcl;
});
};
return getCmd;
}
示例6: UpdateMessageImpl
/// <summary>
/// Implementation for the UpdateMessage method.
/// </summary>
/// <param name="message">A queue message.</param>
/// <param name="visibilityTimeout">The visibility timeout for the message.</param>
/// <param name="updateFlags">Indicates whether to update the visibility delay, message contents, or both.</param>
/// <param name="options">An <see cref="QueueRequestOptions"/> object that specifies any additional options for the request.</param>
/// <returns>A <see cref="RESTCommand{T}"/> that sets the permissions.</returns>
private RESTCommand<NullType> UpdateMessageImpl(CloudQueueMessage message, TimeSpan visibilityTimeout, MessageUpdateFields updateFlags, QueueRequestOptions options)
{
CommonUtils.AssertNotNull("message", message);
CommonUtils.AssertNotNullOrEmpty("messageId", message.Id);
CommonUtils.AssertNotNullOrEmpty("popReceipt", message.PopReceipt);
CommonUtils.AssertInBounds<TimeSpan>("visibilityTimeout", visibilityTimeout, TimeSpan.Zero, CloudQueueMessage.MaxTimeToLive);
if ((updateFlags & MessageUpdateFields.Visibility) == 0)
{
throw new ArgumentException("Calls to UpdateMessage must include the Visibility flag.", "updateFlags");
}
Uri messageUri = this.GetIndividualMessageAddress(message.Id);
RESTCommand<NullType> putCmd = new RESTCommand<NullType>(this.ServiceClient.Credentials, messageUri);
options.ApplyToStorageCommand(putCmd);
putCmd.BuildRequestDelegate = (uri, builder, serverTimeout, ctx) => QueueHttpWebRequestFactory.UpdateMessage(putCmd.Uri, serverTimeout, message.PopReceipt, visibilityTimeout.RoundUpToSeconds(), ctx);
if ((updateFlags & MessageUpdateFields.Content) != 0)
{
MemoryStream memoryStream = new MemoryStream();
QueueRequest.WriteMessageContent(message.GetMessageContentForTransfer(this.EncodeMessage), memoryStream);
memoryStream.Seek(0, SeekOrigin.Begin);
putCmd.SendStream = memoryStream;
putCmd.RecoveryAction = RecoveryActions.RewindStream;
}
else
{
putCmd.SetHeaders = (r, ctx) =>
{
r.ContentLength = 0;
};
}
putCmd.SignRequest = this.ServiceClient.AuthenticationHandler.SignRequest;
putCmd.PreProcessResponse = (cmd, resp, ex, ctx) =>
{
HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.NoContent, resp, NullType.Value, cmd, ex, ctx);
GetPopReceiptAndNextVisibleTimeFromResponse(message, resp);
return NullType.Value;
};
return putCmd;
}
示例7: FetchAttributesImpl
/// <summary>
/// Implementation for the FetchAttributes method.
/// </summary>
/// <param name="options">A <see cref="QueueRequestOptions"/> object that specifies any additional options for the request.</param>
/// <returns>A <see cref="RESTCommand"/> that fetches the attributes.</returns>
private RESTCommand<NullType> FetchAttributesImpl(QueueRequestOptions options)
{
RESTCommand<NullType> getCmd = new RESTCommand<NullType>(this.ServiceClient.Credentials, this.Uri);
options.ApplyToStorageCommand(getCmd);
getCmd.Handler = this.ServiceClient.AuthenticationHandler;
getCmd.BuildClient = HttpClientFactory.BuildHttpClient;
getCmd.BuildRequest = (cmd, cnt, ctx) => QueueHttpRequestMessageFactory.GetMetadata(cmd.Uri, cmd.ServerTimeoutInSeconds, cnt, ctx);
getCmd.PreProcessResponse = (cmd, resp, ex, ctx) =>
{
HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, NullType.Value, cmd, ex, ctx);
GetMessageCountAndMetadataFromResponse(resp);
return NullType.Value;
};
return getCmd;
}
示例8: FetchAttributesImpl
/// <summary>
/// Implementation for the FetchAttributes method.
/// </summary>
/// <param name="options">A <see cref="QueueRequestOptions"/> object that specifies additional options for the request.</param>
/// <returns>A <see cref="RESTCommand"/> that fetches the attributes.</returns>
private RESTCommand<NullType> FetchAttributesImpl(QueueRequestOptions options)
{
RESTCommand<NullType> getCmd = new RESTCommand<NullType>(this.ServiceClient.Credentials, this.StorageUri);
options.ApplyToStorageCommand(getCmd);
getCmd.CommandLocationMode = CommandLocationMode.PrimaryOrSecondary;
getCmd.BuildRequest = (cmd, uri, builder, cnt, serverTimeout, ctx) => QueueHttpRequestMessageFactory.GetMetadata(uri, serverTimeout, cnt, ctx, this.ServiceClient.GetCanonicalizer(), this.ServiceClient.Credentials);
getCmd.PreProcessResponse = (cmd, resp, ex, ctx) =>
{
HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, NullType.Value, cmd, ex);
GetMessageCountAndMetadataFromResponse(resp);
return NullType.Value;
};
return getCmd;
}
示例9: ExistsImpl
/// <summary>
/// Implementation for the Exists method.
/// </summary>
/// <param name="options">A <see cref="QueueRequestOptions"/> object that specifies additional options for the request.</param>
/// <param name="primaryOnly">If <c>true</c>, the command will be executed against the primary location.</param>
/// <returns>A <see cref="RESTCommand"/> that checks existence.</returns>
private RESTCommand<bool> ExistsImpl(QueueRequestOptions options, bool primaryOnly)
{
RESTCommand<bool> getCmd = new RESTCommand<bool>(this.ServiceClient.Credentials, this.StorageUri);
options.ApplyToStorageCommand(getCmd);
getCmd.CommandLocationMode = primaryOnly ? CommandLocationMode.PrimaryOnly : CommandLocationMode.PrimaryOrSecondary;
getCmd.BuildRequest = (cmd, uri, builder, cnt, serverTimeout, ctx) => QueueHttpRequestMessageFactory.GetMetadata(uri, serverTimeout, cnt, ctx, this.ServiceClient.GetCanonicalizer(), this.ServiceClient.Credentials);
getCmd.PreProcessResponse = (cmd, resp, ex, ctx) =>
{
if (resp.StatusCode == HttpStatusCode.NotFound)
{
return false;
}
if (resp.StatusCode == HttpStatusCode.PreconditionFailed)
{
return true;
}
return HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, true, cmd, ex);
};
return getCmd;
}
示例10: CreateQueueImpl
/// <summary>
/// Implementation for the Create method.
/// </summary>
/// <param name="options">A <see cref="QueueRequestOptions"/> object that specifies additional options for the request.</param>
/// <returns>A <see cref="RESTCommand"/> that creates the queue.</returns>
private RESTCommand<NullType> CreateQueueImpl(QueueRequestOptions options)
{
RESTCommand<NullType> putCmd = new RESTCommand<NullType>(this.ServiceClient.Credentials, this.StorageUri);
options.ApplyToStorageCommand(putCmd);
putCmd.BuildRequest = (cmd, uri, builder, cnt, serverTimeout, ctx) =>
{
StorageRequestMessage msg = QueueHttpRequestMessageFactory.Create(uri, serverTimeout, cnt, ctx, this.ServiceClient.GetCanonicalizer(), this.ServiceClient.Credentials);
QueueHttpRequestMessageFactory.AddMetadata(msg, this.Metadata);
return msg;
};
putCmd.PreProcessResponse = (cmd, resp, ex, ctx) =>
{
HttpStatusCode[] expectedHttpStatusCodes = new HttpStatusCode[2];
expectedHttpStatusCodes[0] = HttpStatusCode.Created;
expectedHttpStatusCodes[1] = HttpStatusCode.NoContent;
HttpResponseParsers.ProcessExpectedStatusCodeNoException(expectedHttpStatusCodes, resp, NullType.Value, cmd, ex);
GetMessageCountAndMetadataFromResponse(resp);
return NullType.Value;
};
return putCmd;
}
示例11: DeleteQueueImpl
/// <summary>
/// Implementation for the Delete method.
/// </summary>
/// <param name="options">A <see cref="QueueRequestOptions"/> object that specifies additional options for the request.</param>
/// <returns>A <see cref="RESTCommand"/> that deletes the queue.</returns>
private RESTCommand<NullType> DeleteQueueImpl(QueueRequestOptions options)
{
RESTCommand<NullType> putCmd = new RESTCommand<NullType>(this.ServiceClient.Credentials, this.StorageUri);
options.ApplyToStorageCommand(putCmd);
putCmd.BuildRequest = (cmd, uri, builder, cnt, serverTimeout, ctx) => QueueHttpRequestMessageFactory.Delete(uri, serverTimeout, cnt, ctx, this.ServiceClient.GetCanonicalizer(), this.ServiceClient.Credentials);
putCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.NoContent, resp, NullType.Value, cmd, ex);
return putCmd;
}
示例12: PeekMessageImpl
/// <summary>
/// Implementation for the PeekMessage method.
/// </summary>
/// <param name="options">A <see cref="QueueRequestOptions"/> object that specifies additional options for the request.</param>
/// <returns>A <see cref="RESTCommand"/> that gets the permissions.</returns>
private RESTCommand<CloudQueueMessage> PeekMessageImpl(QueueRequestOptions options)
{
RESTCommand<CloudQueueMessage> getCmd = new RESTCommand<CloudQueueMessage>(this.ServiceClient.Credentials, this.GetMessageRequestAddress());
options.ApplyToStorageCommand(getCmd);
getCmd.RetrieveResponseStream = true;
getCmd.BuildRequest = (cmd, uri, builder, cnt, serverTimeout, ctx) => QueueHttpRequestMessageFactory.PeekMessages(uri, serverTimeout, 1, cnt, ctx, this.ServiceClient.GetCanonicalizer(), this.ServiceClient.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(() =>
{
using (IEnumerator<QueueMessage> enumerator = new GetMessagesResponse(cmd.ResponseStream).Messages.GetEnumerator())
{
if (enumerator.MoveNext())
{
return SelectPeekMessageResponse(enumerator.Current);
}
}
return null;
});
};
return getCmd;
}
示例13: PeekMessagesImpl
/// <summary>
/// Implementation for the PeekMessages method.
/// </summary>
/// <param name="messageCount">The message count.</param>
/// <param name="options">A <see cref="QueueRequestOptions"/> object that specifies additional options for the request.</param>
/// <returns>A <see cref="RESTCommand"/> that gets the permissions.</returns>
private RESTCommand<IEnumerable<CloudQueueMessage>> PeekMessagesImpl(int messageCount, QueueRequestOptions options)
{
RESTCommand<IEnumerable<CloudQueueMessage>> getCmd = new RESTCommand<IEnumerable<CloudQueueMessage>>(this.ServiceClient.Credentials, this.GetMessageRequestAddress());
options.ApplyToStorageCommand(getCmd);
getCmd.CommandLocationMode = CommandLocationMode.PrimaryOrSecondary;
getCmd.RetrieveResponseStream = true;
getCmd.BuildRequest = (cmd, uri, builder, cnt, serverTimeout, ctx) => QueueHttpRequestMessageFactory.PeekMessages(uri, serverTimeout, messageCount, cnt, ctx, this.ServiceClient.GetCanonicalizer(), this.ServiceClient.Credentials);
getCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null, cmd, ex);
getCmd.PostProcessResponse = (cmd, resp, ctx) =>
{
return Task.Factory.StartNew(() =>
{
GetMessagesResponse getMessagesResponse = new GetMessagesResponse(cmd.ResponseStream);
IEnumerable<CloudQueueMessage> messagesList = getMessagesResponse.Messages.Select(item => SelectPeekMessageResponse(item)).ToList();
return messagesList;
});
};
return getCmd;
}
示例14: AddMessageImpl
/// <summary>
/// Implementation for the AddMessage method.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="timeToLive">The maximum time to allow the message to be in the queue, or null.</param>
/// <param name="initialVisibilityDelay">The length of time from now during which the message will be invisible.
/// If <c>null</c> then the message will be visible immediately.</param>
/// <param name="options">A <see cref="QueueRequestOptions"/> object that specifies additional options for the request.</param>
/// <returns>A <see cref="RESTCommand"/> that sets the permissions.</returns>
private RESTCommand<NullType> AddMessageImpl(CloudQueueMessage message, TimeSpan? timeToLive, TimeSpan? initialVisibilityDelay, QueueRequestOptions options)
{
int? timeToLiveInSeconds = null;
int? initialVisibilityDelayInSeconds = null;
if (timeToLive.HasValue)
{
CommonUtility.AssertInBounds("timeToLive", timeToLive.Value, TimeSpan.Zero, CloudQueueMessage.MaxTimeToLive);
timeToLiveInSeconds = (int)timeToLive.Value.TotalSeconds;
}
if (initialVisibilityDelay.HasValue)
{
CommonUtility.AssertInBounds("initialVisibilityDelay", initialVisibilityDelay.Value, TimeSpan.Zero, timeToLive ?? CloudQueueMessage.MaxTimeToLive);
initialVisibilityDelayInSeconds = (int)initialVisibilityDelay.Value.TotalSeconds;
}
MultiBufferMemoryStream memoryStream = new MultiBufferMemoryStream(null /* bufferManager */, (int)(1 * Constants.KB));
QueueRequest.WriteMessageContent(message.GetMessageContentForTransfer(this.EncodeMessage), memoryStream);
memoryStream.Seek(0, SeekOrigin.Begin);
RESTCommand<NullType> putCmd = new RESTCommand<NullType>(this.ServiceClient.Credentials, this.GetMessageRequestAddress());
options.ApplyToStorageCommand(putCmd);
putCmd.BuildRequest = (cmd, uri, builder, cnt, serverTimeout, ctx) => QueueHttpRequestMessageFactory.AddMessage(uri, serverTimeout, timeToLiveInSeconds, initialVisibilityDelayInSeconds, cnt, ctx, this.ServiceClient.GetCanonicalizer(), this.ServiceClient.Credentials);
putCmd.BuildContent = (cmd, ctx) => HttpContentFactory.BuildContentFromStream(memoryStream, 0, memoryStream.Length, null, cmd, ctx);
putCmd.StreamToDispose = memoryStream;
putCmd.PreProcessResponse = (cmd, resp, ex, ctx) =>
{
HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.Created, resp, NullType.Value, cmd, ex);
GetMessageCountAndMetadataFromResponse(resp);
return NullType.Value;
};
return putCmd;
}
示例15: GetPermissionsImpl
/// <summary>
/// Implementation for the GetPermissions method.
/// </summary>
/// <param name="options">An <see cref="QueueRequestOptions"/> object that specifies any additional options for the request.</param>
/// <returns>A <see cref="RESTCommand{T}"/> that gets the permissions.</returns>
private RESTCommand<QueuePermissions> GetPermissionsImpl(QueueRequestOptions options)
{
RESTCommand<QueuePermissions> getCmd = new RESTCommand<QueuePermissions>(this.ServiceClient.Credentials, this.Uri);
options.ApplyToStorageCommand(getCmd);
getCmd.RetrieveResponseStream = true;
getCmd.BuildRequestDelegate = (uri, builder, serverTimeout, ctx) => QueueHttpWebRequestFactory.GetAcl(uri, serverTimeout, ctx);
getCmd.SignRequest = this.ServiceClient.AuthenticationHandler.SignRequest;
getCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null /* retVal */, cmd, ex, ctx);
getCmd.PostProcessResponse = (cmd, resp, ex, ctx) =>
{
QueuePermissions queueAcl = new QueuePermissions();
QueueHttpResponseParsers.ReadSharedAccessIdentifiers(cmd.ResponseStream, queueAcl);
return queueAcl;
};
return getCmd;
}