本文整理汇总了C#中Microsoft.WindowsAzure.Storage.OperationContext类的典型用法代码示例。如果您正苦于以下问题:C# OperationContext类的具体用法?C# OperationContext怎么用?C# OperationContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OperationContext类属于Microsoft.WindowsAzure.Storage命名空间,在下文中一共展示了OperationContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteMessage
public Task DeleteMessage(CloudQueueMessage message, QueueRequestOptions options = null, OperationContext operationContext = null, CancellationToken? cancellationToken = null)
{
return AsyncTaskUtil.RunAsyncCancellable(
_inner.BeginDeleteMessage(message, options, operationContext, null, null),
_inner.EndDeleteMessage,
cancellationToken);
}
示例2: Create
public Task Create(QueueRequestOptions options = null, OperationContext operationContext = null, CancellationToken? cancellationToken = null)
{
return AsyncTaskUtil.RunAsyncCancellable(
_inner.BeginCreate(options, operationContext, null, null),
_inner.EndCreate,
cancellationToken);
}
示例3: DeleteIfExists
public Task<bool> DeleteIfExists(QueueRequestOptions options = null, OperationContext operationContext = null, CancellationToken? cancellationToken = null)
{
return AsyncTaskUtil.RunAsyncCancellable<bool>(
_inner.BeginDeleteIfExists(options, operationContext, null, null),
_inner.EndDeleteIfExists,
cancellationToken);
}
示例4:
IDictionary<string, EntityProperty> ITableEntity.WriteEntity(OperationContext operationContext)
{
return new Dictionary<string, EntityProperty>
{
{ "SerializedError", EntityProperty.GeneratePropertyForString(this.SerializedError) }
};
}
示例5: AddMessage
public Task AddMessage(CloudQueueMessage message, TimeSpan? timeToLive = null, TimeSpan? initialVisibilityDelay = null, QueueRequestOptions options = null, OperationContext operationContext = null, CancellationToken? cancellationToken = null)
{
return AsyncTaskUtil.RunAsyncCancellable(
_inner.BeginAddMessage(message, timeToLive, initialVisibilityDelay, options, operationContext, null, null),
_inner.EndAddMessage,
cancellationToken);
}
示例6: TableGenericQueryEnumerateTwice
public void TableGenericQueryEnumerateTwice()
{
TableQuery<BaseEntity> query = new TableQuery<BaseEntity>();
OperationContext opContext = new OperationContext();
IEnumerable<BaseEntity> enumerable = currentTable.ExecuteQuery(query);
List<BaseEntity> firstIteration = new List<BaseEntity>();
List<BaseEntity> secondIteration = new List<BaseEntity>();
foreach (BaseEntity ent in enumerable)
{
Assert.IsTrue(ent.PartitionKey.StartsWith("tables_batch"));
ent.Validate();
firstIteration.Add(ent);
}
foreach (BaseEntity ent in enumerable)
{
Assert.IsTrue(ent.PartitionKey.StartsWith("tables_batch"));
ent.Validate();
secondIteration.Add(ent);
}
Assert.AreEqual(firstIteration.Count, secondIteration.Count);
for (int m = 0; m < firstIteration.Count; m++)
{
Assert.AreEqual(firstIteration[m].PartitionKey, secondIteration[m].PartitionKey);
Assert.AreEqual(firstIteration[m].RowKey, secondIteration[m].RowKey);
Assert.AreEqual(firstIteration[m].Timestamp, secondIteration[m].Timestamp);
Assert.AreEqual(firstIteration[m].ETag, secondIteration[m].ETag);
firstIteration[m].Validate();
}
}
示例7: ListBlobsSegmented
private Task<BlobResultSegment> ListBlobsSegmented(string prefix, bool useFlatBlobListing, BlobListingDetails blobListingDetails, int? maxResults, BlobContinuationToken continuationToken, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken = default(CancellationToken))
{
return AsyncTaskUtil.RunAsyncCancellable<BlobResultSegment>(
_inner.BeginListBlobsSegmented(prefix, useFlatBlobListing, blobListingDetails, maxResults, continuationToken, options, operationContext, null, null),
_inner.EndListBlobsSegmented,
cancellationToken);
}
示例8: ListContainersSegmented
private Task<ContainerResultSegment> ListContainersSegmented(string prefix, ContainerListingDetails detailsIncluded, int? maxResults, BlobContinuationToken continuationToken, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken = default(CancellationToken))
{
return AsyncTaskUtil.RunAsyncCancellable<ContainerResultSegment>(
_inner.BeginListContainersSegmented(prefix, detailsIncluded, maxResults, continuationToken, options, operationContext, null, null),
_inner.EndListContainersSegmented,
cancellationToken);
}
示例9: Index
// GET: /Subscribe/
public async Task<ActionResult> Index(string id, string listName)
{
// We get to this method when they click on the Confirm link in the
// email that's sent to them after the subscribe service method is called.
TableRequestOptions reqOptions = new TableRequestOptions()
{
MaximumExecutionTime = TimeSpan.FromSeconds(1.5),
RetryPolicy = new LinearRetry(TimeSpan.FromSeconds(3), 3)
};
string filter = TableQuery.CombineFilters(
TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, listName),
TableOperators.And,
TableQuery.GenerateFilterCondition("SubscriberGUID", QueryComparisons.Equal, id));
var query = new TableQuery<Subscriber>().Where(filter);
TableContinuationToken token = null;
OperationContext ctx = new OperationContext() { ClientRequestID = "" };
TableQuerySegment<Subscriber> currentSegment = null;
currentSegment = await mailingListTable.ExecuteQuerySegmentedAsync(query, token, reqOptions, ctx);
var subscriber = currentSegment.Results.ToList().Single();
//subscriberTableRow.Status = "Verified";
subscriber.Verified = true;
var replaceOperation = TableOperation.Merge(subscriber);
mailingListTable.Execute(replaceOperation);
var newSubscriber = new SubscribeVM();
newSubscriber.EmailAddress = subscriber.EmailAddress;
var mailingList = await FindRowAsync(subscriber.ListName, "mailinglist");
newSubscriber.ListDescription = mailingList.Description;
return View(newSubscriber);
}
示例10: GetMetadata
/// <summary>
/// Generates a web request to return the user-defined metadata for this share.
/// </summary>
/// <param name="uri">The absolute URI to the share.</param>
/// <param name="timeout">The server timeout interval.</param>
/// <param name="accessCondition">The access condition to apply to the request.</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 for tracking the current operation.</param>
/// <returns>A web request to use to perform the operation.</returns>
public static HttpWebRequest GetMetadata(Uri uri, int? timeout, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)
{
UriQueryBuilder shareBuilder = GetShareUriQueryBuilder();
HttpWebRequest request = HttpWebRequestFactory.GetMetadata(uri, timeout, shareBuilder, useVersionHeader, operationContext);
request.ApplyAccessCondition(accessCondition);
return request;
}
示例11: GetMetadata
/// <summary>
/// Generates a web request to return the user-defined metadata for this container.
/// </summary>
/// <param name="uri">The absolute URI to the container.</param>
/// <param name="timeout">The server timeout interval.</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 HttpRequestMessage GetMetadata(Uri uri, int? timeout, AccessCondition accessCondition, HttpContent content, OperationContext operationContext)
{
UriQueryBuilder containerBuilder = GetContainerUriQueryBuilder();
HttpRequestMessage request = HttpRequestMessageFactory.GetMetadata(uri, timeout, containerBuilder, content, operationContext);
request.ApplyAccessCondition(accessCondition);
return request;
}
示例12: GetMetadata
/// <summary>
/// Generates a web request to return the user-defined metadata for this container.
/// </summary>
/// <param name="uri">The absolute URI to the container.</param>
/// <param name="timeout">The server timeout interval.</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 GetMetadata(Uri uri, int? timeout, AccessCondition accessCondition, HttpContent content, OperationContext operationContext, ICanonicalizer canonicalizer, StorageCredentials credentials)
{
UriQueryBuilder containerBuilder = GetContainerUriQueryBuilder();
StorageRequestMessage request = HttpRequestMessageFactory.GetMetadata(uri, timeout, containerBuilder, content, operationContext, canonicalizer, credentials);
request.ApplyAccessCondition(accessCondition);
return request;
}
示例13: ListBlobsSegmentedAsync
public static async Task<ReadOnlyCollection<IListBlobItem>> ListBlobsSegmentedAsync(
this CloudBlobDirectory container,
bool useFlatBlobListing,
int pageSize,
BlobListingDetails details,
BlobRequestOptions options,
OperationContext operationContext,
IProgress<IEnumerable<IListBlobItem>> progress = null,
CancellationToken cancellationToken = default(CancellationToken)) {
options = options ?? new BlobRequestOptions();
var results = new List<IListBlobItem>();
BlobContinuationToken continuation = null;
BlobResultSegment segment;
do {
segment = await Task.Factory.FromAsync(
(cb, state) => container.BeginListBlobsSegmented(useFlatBlobListing, details, pageSize, continuation, options, operationContext, cb, state).WithCancellation(cancellationToken),
ar => container.EndListBlobsSegmented(ar),
null);
if (progress != null) {
progress.Report(segment.Results);
}
results.AddRange(segment.Results);
continuation = segment.ContinuationToken;
} while (continuation != null);
return new ReadOnlyCollection<IListBlobItem>(results);
}
开发者ID:AArnott,项目名称:Microsoft.WindowsAzure.StorageClient.Async,代码行数:27,代码来源:AzureBlobStorageExtensions.cs
示例14: WriteEntityContactMessage
public void WriteEntityContactMessage()
{
var msg = new ContactMessage
{
From = new Contact
{
ContactId = "A",
DisplayName = "Bob"
},
To = new Contact
{
ContactId = "B",
DisplayName = "Jane"
},
MessageBody = "Test"
};
var context = new OperationContext();
var proxy = new TableEntityProxy<ContactMessage>(msg);
var props = proxy.WriteEntity(context);
Assert.AreEqual("A", props["FromContactId"].StringValue);
Assert.AreEqual("Bob", props["FromDisplayName"].StringValue);
Assert.AreEqual("B", props["ToContactId"].StringValue);
Assert.AreEqual("Jane", props["ToDisplayName"].StringValue);
}
示例15: Delete
/// <summary>
/// Constructs a web request to delete the container and all of the blobs within it.
/// </summary>
/// <param name="uri">The absolute URI to the container.</param>
/// <param name="timeout">The server timeout interval.</param>
/// <param name="accessCondition">The access condition to apply to the request.</param>
/// <param name="operationContext">An <see cref="OperationContext"/> object for tracking the current operation.</param>
/// <returns>A web request to use to perform the operation.</returns>
public static HttpWebRequest Delete(Uri uri, int? timeout, AccessCondition accessCondition, OperationContext operationContext)
{
UriQueryBuilder containerBuilder = GetContainerUriQueryBuilder();
HttpWebRequest request = HttpWebRequestFactory.Delete(uri, containerBuilder, timeout, operationContext);
request.ApplyAccessCondition(accessCondition);
return request;
}