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

            return(Task <ServiceProperties> .Factory.FromAsync(
                       asyncResult,
                       result =>
            {
                registration.Dispose();
                return tableClient.EndGetServiceProperties(result);
            }));
        }
예제 #2
0
 public ServiceProperties EndGetServiceProperties(IAsyncResult asyncResult)
 {
     return(_cloudTableClient.EndGetServiceProperties(asyncResult));
 }