예제 #1
0
        public void QueryTables()
        {
            string storageUri        = StorageUri;
            string accountName       = StorageAccountName;
            string storageAccountKey = PrimaryStorageAccountKey;
            string tableName         = "OfficeSupplies3p1" + _random.Next();

            var serviceClient = new TableServiceClient(
                new Uri(storageUri),
                new TableSharedKeyCredential(accountName, storageAccountKey));

            serviceClient.CreateTable(tableName);

            #region Snippet:TablesSample3QueryTables
            // Use the <see cref="TableServiceClient"> to query the service. Passing in OData filter strings is optional.

            Pageable <TableItem> queryTableResults = serviceClient.Query(filter: $"TableName eq '{tableName}'");

            Console.WriteLine("The following are the names of the tables in the query results:");

            // Iterate the <see cref="Pageable"> in order to access queried tables.

            foreach (TableItem table in queryTableResults)
            {
                Console.WriteLine(table.Name);
            }
            #endregion

            serviceClient.DeleteTable(tableName);
        }
예제 #2
0
        public List <string> ListTables()
        {
            var result     = new List <string>();
            var tableItems = tableServiceClient.Query();

            foreach (var tableItem in tableItems)
            {
                result.Add(tableItem.Name);
            }
            return(result);
        }
예제 #3
0
 /// <summary>
 /// Does the table exist
 /// </summary>
 /// <returns></returns>
 public bool TableExists()
 {
     return(_cloudTableService.Query(e => e.Name == _tableName).Any());
 }