获取一个空列表,但我可以插入数据

时间:2013-01-14 21:09:44

标签: c# azure windows-phone windows-phone-8

我正在使用Windows Phone 8的Azure示例,但我的列表返回空:

var items = App.MobileService.GetTable<MyItem>().ToCollectionView();

但我完全可以通过

插入一行
await App.MobileService.GetTable<MyItem>().InsertAsync(newMyItem);

在Web管理器中查看表我发现我正在填充列表。

有人知道吗?

1 个答案:

答案 0 :(得分:0)

我的猜测是调用“ToCollectionView”是异步的,当你检查时它还没有收到。尝试使用“ReadAsync”方法:

var items = await App.MobileService.GetTable<MyItem>().ReadAsync();