本文整理汇总了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();
}
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
}