概要
简单代码示例
static void Main(string[] args)
{
try
{
CloudStorageAccount storageAccount =
CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=<your_storage_name>;AccountKey=<your_account_key>");
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
CloudTable table = tableClient.GetTableReference("people");
table.CreateIfNotExists();
CustomerEntity customer1 = new CustomerEntity("Harp", "Walter");
customer1.Email = "[email protected]";
customer1.PhoneNumber = "425-555-0101";
// Create the TableOperation that inserts the customer entity.
var insertOperation = TableOperation.Insert(customer1);
// Execute the insert operation.
table.Execute(insertOperation);
// Read storage
TableQuery<CustomerEntity> query =
new TableQuery<CustomerEntity>()
.Where(TableQuery.GenerateFilterCondition("PartitionKey",
QueryComparisons.Equal, "Harp"));
var list = table.ExecuteQuery(query).ToList();
}
catch (StorageException ex)
{
// Exception handling here.
}
}
public class CustomerEntity : TableEntity
{
public string Email { get; set; }
public string PhoneNumber { get; set; }
public CustomerEntity(string lastName, string firstName)
{
PartitionKey = lastName;
RowKey = firstName;
}
public CustomerEntity() { }
}
问题
1.没有一个表与Blob或容器不同。容器用于容纳Blob,如果Blob是文件,则将它们视为驱动器。
表具有特定功能,例如可以指定影响性能的分区和键。
2. Azure管理界面没有提供用于处理表的界面,您只能在仪表板和“监视”选项卡中查看指标。
对于管理,我建议您获得Cerebrata的Azure Management Studio,或者如果您想要免费的内容,请查看Azure Storage Explorer。两者都可以让您更好地管理表。
3.表结构是从不需要创建或管理列的实体中生成的,甚至可以跨同一表中的实体来改变列(尽管我个人不喜欢此功能)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句