Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linq 在移动服务Azure中计数_Linq_Azure_Windows Phone_Azure Mobile Services - Fatal编程技术网

Linq 在移动服务Azure中计数

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

我正在使用Azure(适用于Windows Phone)的移动服务,并有如下查询:

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;
    }
});