Exemplo n.º 1
0
        /// <summary>
        /// Constructs AzureSTorageTable from track 2 TableClient.
        /// Internally it construcs track 1 CloudTable for property display purpose only.
        /// </summary>
        /// <param name="tableClient"></param>
        public AzureStorageTable(TableClient tableClient)
        {
            this.TableClient = tableClient;
            this.Name        = tableClient.Name;

            Uri uri = (Uri)typeof(TableClient)
                      .GetField("_endpoint", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
                      .GetValue(tableClient);

            this.Uri = new Uri($"{uri.AbsoluteUri}{(uri.AbsoluteUri.EndsWith("/") ? string.Empty : "/")}{Name}");

            // This constructed CloudTable is only for display purpose.
            // Without credential content, it wouldn't work for data plane operations.
            // Customer, who uses oauth, should use track 2 TableClient instead.
            this.CloudTable = new CloudTable(Uri);
        }