Example #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 void EndSetServiceProperties(IAsyncResult asyncResult)
 {
     _cloudTableClient.EndSetServiceProperties(asyncResult);
 }