Linq 在移动服务Azure中计数
我正在使用Azure(适用于Windows Phone)的移动服务,并有如下查询:Linq 在移动服务Azure中计数,linq,azure,windows-phone,azure-mobile-services,Linq,Azure,Windows Phone,Azure Mobile Services,我正在使用Azure(适用于Windows Phone)的移动服务,并有如下查询: await App.MobileService.GetTable<MyTable>().Skip(1).Take(100).ToListAsync().ContinueWith(t => { if (!t.IsFaulted) { //do
await App.MobileService.GetTable<MyTable>().Skip(1).Take(100).ToListAsync().ContinueWith(t =>
{
if (!t.IsFaulted)
{
//do something
}
});
wait App.MobileService.GetTable().Skip(1).Take(100).toListSync().ContinueWith(t=>
{
如果(!t.IsFaulted)
{
//做点什么
}
});
问题是,我如何知道“MyTable”表中的总行数?
谢谢 您可以在创建队列时使用
IncludeTotalCount()
,一旦这样做,结果可以转换到ITotalCountProvider
界面,您可以从该界面检索总行数(这将匹配您传递的任何筛选选项;在您的示例中,由于您没有使用任何Where
子句,因此它将返回表中的记录总数)
c.GetTable().Skip(1).Take(100).IncludeTotalCount().toListSync().ContinueWith(t=>
{
如果(!t.IsFaulted)
{
列表结果=t.结果;
var totalCountProvider=(ITotalCountProvider)t.Result;
var totalCount=totalCountProvider.totalCount;
}
});
c.GetTable<MyTable>().Skip(1).Take(100).IncludeTotalCount().ToListAsync().ContinueWith(t =>
{
if (!t.IsFaulted)
{
List<MyTable> results = t.Result;
var totalCountProvider = (ITotalCountProvider)t.Result;
var totalCount = totalCountProvider.TotalCount;
}
});