2012-11-22 103 views
0

以下是用於從Azure Table中獲取數據的代碼:查詢天青表不返回任何數據

一切工作正常。突然我發現,上面的調用不會返回任何東西。 它能夠獲得ServiceContext。我試圖使用"Fidler"工具進行故障排除。實際上數據來自雲表(我在Fidler的查詢響應中看到)。但是當我迭代"partitionQuery"對象時,它返回時沒有數據。相同的代碼適用於其他機器。所使用的Azure SDK也與其他機器相同。任何人都可以幫忙嗎?謝謝。

更新:現在我正在使用新版本的Azure SDK。 (2012年10月)這可能是一個問題嗎?

回答

0

我遇到了同樣的問題。當我指定分區鍵(或任何其他查詢)時,它工作得很好。

rangeQuery = new TableQuery<PhotoEvent>().Where(TableQuery.GenerateFilterConditionForBool("active", QueryComparisons.Equal, true)); 
+0

是否因爲版本更改? –

1

如果您使用的是2012年10月Azure的SDK,你想改變:

TableServiceContext serviceContext = tableClient.GetDataServiceContext(); 

CloudTableQuery<Customer> partitionQuery = (from e in serviceContext.CreateQuery<Customer>("Customer") 
select e).AsTableServiceQuery<Customer>(); 

TableServiceContext serviceContext = tableClient.GetTableServiceContext(); 

TableServiceQuery<Customer > partitionQuery = (from e in serviceContext.CreateQuery<Customer>(「Customer」) 
                   select e).AsTableServiceQuery(serviceContext); 

注:見more detailed list of breaking change

此外,請確保您已包含Microsoft.WindowsAzure.Storage.Table.DataServices命名空間。

如果您仍然在觀察意外的行爲,請提供一個提琴手跟蹤(通過電子郵件),以便我們可以進一步調查此問題。