當前位置: 首頁>>代碼示例>>C#>>正文


C# CloudTableClient.ListTables方法代碼示例

本文整理匯總了C#中Microsoft.WindowsAzure.Storage.Table.CloudTableClient.ListTables方法的典型用法代碼示例。如果您正苦於以下問題:C# CloudTableClient.ListTables方法的具體用法?C# CloudTableClient.ListTables怎麽用?C# CloudTableClient.ListTables使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Microsoft.WindowsAzure.Storage.Table.CloudTableClient的用法示例。


在下文中一共展示了CloudTableClient.ListTables方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ClassCleanup

        public static void ClassCleanup()
        {
            var storageAccountProvider = new ConnectionStringCloudStorageAccount( ConfigurationManager.AppSettings["storageConnectionString"] );

             var client = new CloudTableClient( new Uri( storageAccountProvider.TableEndpoint ),
                                         storageAccountProvider.Credentials );

             var orphanedTables = client.ListTables( _baseTableName );
             foreach ( var orphanedTableName in orphanedTables )
             {
            client.GetTableReference( orphanedTableName.Name ).DeleteIfExists();
             }
        }
開發者ID:mmcgill,項目名稱:hyde,代碼行數:13,代碼來源:DynamicTest.cs

示例2: Main

        static void Main(string[] args)
        {
            var storageCredentials = new StorageCredentials(accountName, keyValue);
            var storageAccount = new CloudStorageAccount(storageCredentials, true);

            tableClient = storageAccount.CreateCloudTableClient();

            Autos();

            //Persons();

            var tables = tableClient.ListTables();

            Console.ReadLine();
        }
開發者ID:cwissmann,項目名稱:dojo,代碼行數:15,代碼來源:Program.cs

示例3: LoadLeftPane


//.........這裏部分代碼省略.........
                        queueSection.IsExpanded = true;
                        break;
                    case ItemType.TABLE_SERVICE:
                    case ItemType.TABLE_CONTAINER:
                        tableSection.IsExpanded = true;
                        break;
                    default:
                        blobSection.IsExpanded = true;
                        break;
                }


            }
            catch (Exception ex)
            {
                ShowError("Error enumering blob containers in the storage account: " + ex.Message);
            }

            try
            { 
                IEnumerable<CloudQueue> queues = queueClient.ListQueues();

                if (queues != null)
                {
                    foreach (CloudQueue queue in queues)
                    {
                        StackPanel stack = new StackPanel();
                        stack.Orientation = Orientation.Horizontal;

                        Image cloudFolderImage = new Image();
                        cloudFolderImage.Source = new BitmapImage(new Uri("pack://application:,,/Images/cloud_queue.png"));
                        cloudFolderImage.Height = 24;

                        Label label = new Label();
                        label.Content = queue.Name;

                        stack.Children.Add(cloudFolderImage);
                        stack.Children.Add(label);

                        queueSection.Items.Add(new TreeViewItem()
                        {
                            Header = stack,
                            Tag = new OutlineItem()
                            {
                                ItemType = ItemType.QUEUE_CONTAINER,
                                Container = queue.Name
                            }
                        });
                    }
                }
                queueSection.Header = "Queues (" + queues.Count().ToString() + ")";
            }
            catch (Exception ex)
            {
                ShowError("Error enumering queues in storage account: " + ex.Message);
            }

            // OData version number occurs here:
            // Could not load file or assembly 'Microsoft.Data.OData, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

            try
            {
                IEnumerable<CloudTable> tables = tableClient.ListTables();
                if (tables != null)
                {
                    foreach (CloudTable table in tables)
                    {
                        StackPanel stack = new StackPanel();
                        stack.Orientation = Orientation.Horizontal;

                        Image cloudFolderImage = new Image();
                        cloudFolderImage.Source = new BitmapImage(new Uri("pack://application:,,/Images/cloud_table.png"));
                        cloudFolderImage.Height = 24;

                        Label label = new Label();
                        label.Content = table.Name;

                        stack.Children.Add(cloudFolderImage);
                        stack.Children.Add(label);

                        tableSection.Items.Add(new TreeViewItem()
                        {
                            Header = stack,
                            Tag = new OutlineItem()
                            {
                                ItemType = ItemType.TABLE_CONTAINER,
                                Container = table.Name
                            }
                        });
                    }
                }
                tableSection.Header = "Tables (" + tables.Count().ToString() + ")";
            }
            catch(Exception ex)
            {
                ShowError("Error enumerating tables in storage account: " + ex.Message);
            }

            Cursor = Cursors.Arrow;
        }
開發者ID:jhasselkus,項目名稱:AzureStorageExplorer,代碼行數:101,代碼來源:StorageView.xaml.cs

示例4: PlsTableNames

        public List<string> PlsTableNames()
        {
            string sConnectionString = String.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}",
                                                     m_sAccountName, m_sAccountKey);

            try
                {
                m_csa = CloudStorageAccount.Parse(sConnectionString);

                if (m_csa == null)
                    return null;

                m_ctc = m_csa.CreateCloudTableClient();
                if (m_ctc == null)
                    return null;

                // trye to enumerate the tables
                }
            catch
                {
                return null;
                }

            List<string> pls;
            try
                {
                IEnumerable<CloudTable> plct = m_ctc.ListTables();

                m_plct = new List<CloudTable>();
                pls = new List<string>();

                foreach (CloudTable ct in plct)
                    {
                    m_plct.Add(ct);
                    pls.Add(ct.Name);
                    }
                }
            catch
                {
                return null;
                }

            return pls;
        }
開發者ID:rlittletht,項目名稱:AzLog,代碼行數:44,代碼來源:AzTableCollection.cs

示例5: ListAllTables

        /// <summary>
        /// Lists all tables in the storage account.
        /// </summary>
        /// <param name="tableClient">The Table storage service client object.</param>
        private static void ListAllTables(CloudTableClient tableClient)
        {
            Console.WriteLine("List all tables in account:");

            try
            {
                // Note that listing all tables in the account may take a long time if the account contains a large number of tables.
                foreach (var table in tableClient.ListTables())
                {
                    Console.WriteLine("\tTable:" + table.Name);
                }

                Console.WriteLine();
            }
            catch (StorageException e)
            {
                Console.WriteLine(e.Message);
                Console.ReadLine();
                throw;
            }
        }
開發者ID:Azure-Samples,項目名稱:storage-table-dotnet-getting-started,代碼行數:25,代碼來源:AdvancedSamples.cs


注:本文中的Microsoft.WindowsAzure.Storage.Table.CloudTableClient.ListTables方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。