2017-06-30 1 views
0
TableOperation retrieve = TableOperation.Retrieve<CustomerEntity>("PartitionKeyvalue", "Rowkey"); 
TableResult result = table.Execute(retreive); 

この単一のエンティティにはプロパティがありますが、なぜ私はそれらをresult.Result.(Property)のようにアクセスできませんか?リトリーブ<entity>を使用した後、単一のエンティティのプロパティにアクセスできないのはなぜですか?

TableResultに格納されている単一のエンティティを必ずループする必要がありますか?

// Retrieve the storage account from the connection string. 
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString")); 

// Create the table client. 
CloudTableClient tableClient = storageAccount.CreateCloudTableClient(); 

// Create the CloudTable object that represents the "people" table. 
CloudTable table = tableClient.GetTableReference("people"); 

// Create a retrieve operation that takes a customer entity. 
TableOperation retrieveOperation = TableOperation.Retrieve<CustomerEntity>("Smith", "Ben"); 

// Execute the retrieve operation. 
TableResult retrievedResult = table.Execute(retrieveOperation); 

// Print the phone number of the result. 
if (retrievedResult.Result != null) 
{ 
    Console.WriteLine(((CustomerEntity)retrievedResult.Result).PhoneNumber); 
} 
else 
{ 
    Console.WriteLine("The phone number could not be retrieved."); 
} 
+0

ようこそSOへ: – petezurich

答えて

関連する問題