Exemple #1
0
        /// <summary>
        ///     Sets the properties of the table service asynchronously.
        /// </summary>
        /// <param name="tableClient">Cloud table client.</param>
        /// <param name="serviceProperties">The table service properties.</param>
        /// <param name="cancellationToken">Cancellation token.</param>
        /// <returns>Task.</returns>
        public static Task SetServicePropertiesAsync(
            this CloudTableClient tableClient,
            ServiceProperties serviceProperties,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            ICancellableAsyncResult       asyncResult  = tableClient.BeginSetServiceProperties(serviceProperties, null, null);
            CancellationTokenRegistration registration = cancellationToken.Register(p => asyncResult.Cancel(), null);

            return(Task.Factory.FromAsync(
                       asyncResult,
                       result =>
            {
                registration.Dispose();
                tableClient.EndSetServiceProperties(result);
            }));
        }
 public ICancellableAsyncResult BeginSetServiceProperties(ServiceProperties properties, AsyncCallback callback, object state)
 {
     return(_cloudTableClient.BeginSetServiceProperties(properties, callback, state));
 }