我正在玩天蓝色表存储实体检索并获得了一个很好的 ms 示例
万一你无聊地检查链接
// Retrieve storage account from connection string
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString"));
// Create the table client
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
// Get the data service context
TableServiceContext serviceContext = tableClient.GetDataServiceContext();
// Specify a partition query, using "Smith" as the partition key
CloudTableQuery<CustomerEntity> partitionQuery =
(from e in serviceContext.CreateQuery<CustomerEntity>("people")
where e.PartitionKey == "Smith"
select e).AsTableServiceQuery<CustomerEntity>();
// Loop through the results, displaying information about the entity
foreach (CustomerEntity entity in partitionQuery)
{
Console.WriteLine("{0}, {1}\t{2}\t{3}", entity.PartitionKey, entity.RowKey,
entity.Email, entity.PhoneNumber);
}
现在这很完美。但我想概括它..所以我想将 customerEntity 作为参数传递,将 people 作为参数传递(简单字符串表名)并使其可重用。
所以技巧是将customerentity作为参数传递请帮助:)