本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Table.TableRequestOptions.AssertPolicyIfRequired方法的典型用法代码示例。如果您正苦于以下问题:C# TableRequestOptions.AssertPolicyIfRequired方法的具体用法?C# TableRequestOptions.AssertPolicyIfRequired怎么用?C# TableRequestOptions.AssertPolicyIfRequired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.WindowsAzure.Storage.Table.TableRequestOptions
的用法示例。
在下文中一共展示了TableRequestOptions.AssertPolicyIfRequired方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RetrieveImpl
private static RESTCommand<TableResult> RetrieveImpl(TableOperation operation, CloudTableClient client, CloudTable table, TableRequestOptions requestOptions)
{
requestOptions.AssertPolicyIfRequired();
RESTCommand<TableResult> retrieveCmd = new RESTCommand<TableResult>(client.Credentials, operation.GenerateRequestURI(client.StorageUri, table.Name));
requestOptions.ApplyToStorageCommand(retrieveCmd);
TableResult result = new TableResult();
retrieveCmd.CommandLocationMode = operation.isPrimaryOnlyRetrieve ? CommandLocationMode.PrimaryOnly : CommandLocationMode.PrimaryOrSecondary;
retrieveCmd.RetrieveResponseStream = true;
retrieveCmd.SignRequest = client.AuthenticationHandler.SignRequest;
retrieveCmd.ParseError = StorageExtendedErrorInformation.ReadFromStreamUsingODataLib;
retrieveCmd.BuildRequestDelegate = (uri, builder, timeout, useVersionHeader, ctx) => TableOperationHttpWebRequestFactory.BuildRequestForTableOperation(uri, builder, client.BufferManager, timeout, operation, useVersionHeader, ctx, requestOptions, client.AccountName).Item1;
retrieveCmd.PreProcessResponse = (cmd, resp, ex, ctx) => TableOperationHttpResponseParsers.TableOperationPreProcess(result, operation, resp, ex);
retrieveCmd.PostProcessResponse = (cmd, resp, ctx) =>
{
if (resp.StatusCode == HttpStatusCode.NotFound)
{
return result;
}
result = TableOperationHttpResponseParsers.TableOperationPostProcess(result, operation, cmd, resp, ctx, requestOptions, client.AccountName);
return result;
};
return retrieveCmd;
}
示例2: RetrieveImpl
private static RESTCommand<TableResult> RetrieveImpl(TableOperation operation, CloudTableClient client, CloudTable table, TableRequestOptions requestOptions)
{
requestOptions.AssertPolicyIfRequired();
RESTCommand<TableResult> retrieveCmd = new RESTCommand<TableResult>(client.Credentials, operation.GenerateRequestURI(client.StorageUri, table.Name));
requestOptions.ApplyToStorageCommand(retrieveCmd);
TableResult result = new TableResult();
if (operation.SelectColumns != null && operation.SelectColumns.Count > 0)
{
// If encryption policy is set, then add the encryption metadata column to Select columns in order to be able to decrypt properties.
if (requestOptions.EncryptionPolicy != null)
{
operation.SelectColumns.Add(Constants.EncryptionConstants.TableEncryptionKeyDetails);
operation.SelectColumns.Add(Constants.EncryptionConstants.TableEncryptionPropertyDetails);
}
retrieveCmd.Builder = operation.GenerateQueryBuilder(requestOptions.ProjectSystemProperties);
}
retrieveCmd.CommandLocationMode = operation.isPrimaryOnlyRetrieve ? CommandLocationMode.PrimaryOnly : CommandLocationMode.PrimaryOrSecondary;
retrieveCmd.RetrieveResponseStream = true;
retrieveCmd.SignRequest = client.AuthenticationHandler.SignRequest;
retrieveCmd.ParseError = StorageExtendedErrorInformation.ReadFromStreamUsingODataLib;
retrieveCmd.BuildRequestDelegate = (uri, builder, timeout, useVersionHeader, ctx) => TableOperationHttpWebRequestFactory.BuildRequestForTableOperation(uri, builder, client.BufferManager, timeout, operation, useVersionHeader, ctx, requestOptions, client.AccountName).Item1;
retrieveCmd.PreProcessResponse = (cmd, resp, ex, ctx) => TableOperationHttpResponseParsers.TableOperationPreProcess(result, operation, resp, ex);
retrieveCmd.PostProcessResponse = (cmd, resp, ctx) =>
{
if (resp.StatusCode == HttpStatusCode.NotFound)
{
return result;
}
result = TableOperationHttpResponseParsers.TableOperationPostProcess(result, operation, cmd, resp, ctx, requestOptions, client.AccountName);
return result;
};
return retrieveCmd;
}