本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Shared.Protocol.ServiceProperties.WriteServiceProperties方法的典型用法代码示例。如果您正苦于以下问题:C# ServiceProperties.WriteServiceProperties方法的具体用法?C# ServiceProperties.WriteServiceProperties怎么用?C# ServiceProperties.WriteServiceProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.WindowsAzure.Storage.Shared.Protocol.ServiceProperties
的用法示例。
在下文中一共展示了ServiceProperties.WriteServiceProperties方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetServicePropertiesImpl
private RESTCommand<NullType> SetServicePropertiesImpl(ServiceProperties properties, TableRequestOptions requestOptions)
{
MultiBufferMemoryStream memoryStream = new MultiBufferMemoryStream(null /* bufferManager */, (int)(1 * Constants.KB));
try
{
properties.WriteServiceProperties(memoryStream);
}
catch (InvalidOperationException invalidOpException)
{
throw new ArgumentException(invalidOpException.Message, "properties");
}
RESTCommand<NullType> retCmd = new RESTCommand<NullType>(this.Credentials, this.StorageUri);
requestOptions.ApplyToStorageCommand(retCmd);
retCmd.BuildRequest = (cmd, uri, builder, cnt, serverTimeout, ctx) => TableHttpRequestMessageFactory.SetServiceProperties(uri, serverTimeout, cnt, ctx);
retCmd.BuildContent = (cmd, ctx) => HttpContentFactory.BuildContentFromStream(memoryStream, 0, memoryStream.Length, null /* md5 */, cmd, ctx);
retCmd.Handler = this.AuthenticationHandler;
retCmd.BuildClient = HttpClientFactory.BuildHttpClient;
retCmd.PreProcessResponse =
(cmd, resp, ex, ctx) =>
HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.Accepted, resp, null /* retVal */, cmd, ex);
requestOptions.ApplyToStorageCommand(retCmd);
return retCmd;
}
示例2: SetServicePropertiesImpl
private RESTCommand<NullType> SetServicePropertiesImpl(ServiceProperties properties, BlobRequestOptions requestOptions)
{
MemoryStream str = new MemoryStream();
try
{
properties.WriteServiceProperties(str);
}
catch (InvalidOperationException invalidOpException)
{
throw new ArgumentException(invalidOpException.Message, "properties");
}
str.Seek(0, SeekOrigin.Begin);
RESTCommand<NullType> retCmd = new RESTCommand<NullType>(this.Credentials, this.BaseUri);
retCmd.SendStream = str;
retCmd.BuildRequestDelegate = BlobHttpWebRequestFactory.SetServiceProperties;
retCmd.RecoveryAction = RecoveryActions.RewindStream;
retCmd.SignRequest = this.AuthenticationHandler.SignRequest;
retCmd.PreProcessResponse =
(cmd, resp, ex, ctx) =>
HttpResponseParsers.ProcessExpectedStatusCodeNoException(System.Net.HttpStatusCode.Accepted, resp, NullType.Value, cmd, ex, ctx);
retCmd.ApplyRequestOptions(requestOptions);
return retCmd;
}
示例3: SetServicePropertiesImpl
private RESTCommand<NullType> SetServicePropertiesImpl(ServiceProperties properties, BlobRequestOptions requestOptions)
{
MemoryStream memoryStream = new MemoryStream();
try
{
properties.WriteServiceProperties(memoryStream);
}
catch (InvalidOperationException invalidOpException)
{
throw new ArgumentException(invalidOpException.Message, "properties");
}
RESTCommand<NullType> retCmd = new RESTCommand<NullType>(this.Credentials, this.BaseUri);
retCmd.ApplyRequestOptions(requestOptions);
retCmd.BuildRequest = (cmd, cnt, ctx) => BlobHttpRequestMessageFactory.SetServiceProperties(cmd.Uri, cmd.ServerTimeoutInSeconds, cnt, ctx);
retCmd.BuildContent = (cmd, ctx) => HttpContentFactory.BuildContentFromStream(memoryStream, 0, memoryStream.Length, null /* md5 */, cmd, ctx);
retCmd.RetrieveResponseStream = true;
retCmd.Handler = this.AuthenticationHandler;
retCmd.BuildClient = HttpClientFactory.BuildHttpClient;
retCmd.PreProcessResponse =
(cmd, resp, ex, ctx) =>
HttpResponseParsers.ProcessExpectedStatusCodeNoException(System.Net.HttpStatusCode.Accepted, resp, null /* retVal */, cmd, ex, ctx);
retCmd.ApplyRequestOptions(requestOptions);
return retCmd;
}
示例4: WriteServiceProperties
/// <summary>
/// Writes Queue service properties to a stream, formatted in XML.
/// </summary>
/// <param name="properties">A <see cref="ServiceProperties"/> object.</param>
/// <param name="outputStream">The <see cref="System.IO.Stream"/> object to which the formatted properties are to be written.</param>
public static void WriteServiceProperties(ServiceProperties properties, Stream outputStream)
{
CommonUtility.AssertNotNull("properties", properties);
properties.WriteServiceProperties(outputStream);
}
示例5: SetServicePropertiesImpl
private RESTCommand<NullType> SetServicePropertiesImpl(ServiceProperties properties, QueueRequestOptions requestOptions)
{
MultiBufferMemoryStream str = new MultiBufferMemoryStream(null /* bufferManager */, (int)(1 * Constants.KB));
try
{
properties.WriteServiceProperties(str);
}
catch (InvalidOperationException invalidOpException)
{
str.Dispose();
throw new ArgumentException(invalidOpException.Message, "properties");
}
str.Seek(0, SeekOrigin.Begin);
RESTCommand<NullType> retCmd = new RESTCommand<NullType>(this.Credentials, this.StorageUri);
retCmd.SendStream = str;
retCmd.StreamToDispose = str;
retCmd.BuildRequestDelegate = QueueHttpWebRequestFactory.SetServiceProperties;
retCmd.RecoveryAction = RecoveryActions.RewindStream;
retCmd.SignRequest = this.AuthenticationHandler.SignRequest;
retCmd.PreProcessResponse =
(cmd, resp, ex, ctx) =>
HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.Accepted, resp, NullType.Value, cmd, ex);
requestOptions.ApplyToStorageCommand(retCmd);
return retCmd;
}
示例6: WriteServiceProperties
/// <summary>
/// Writes service properties to a stream, formatted in XML.
/// </summary>
/// <param name="properties">The service properties to format and write to the stream.</param>
/// <param name="outputStream">The stream to which the formatted properties are to be written.</param>
public static void WriteServiceProperties(ServiceProperties properties, Stream outputStream)
{
properties.WriteServiceProperties(outputStream);
}