Silverlight 4.0 筛选时RiaServices和entityQuery.IncludeTotalCount出现智能分页问题

Silverlight 4.0 筛选时RiaServices和entityQuery.IncludeTotalCount出现智能分页问题,silverlight-4.0,pagination,wcf-ria-services,Silverlight 4.0,Pagination,Wcf Ria Services,我正在使用RiaServices使用EntityQuery填充网格 因为我的数据库有数百万行,所以我只想查询当前页面,还要查询总行数,以便分页 例:共100行 entityQuery.Skip(0).Take(10); //for the first page entityQuery.IncludeTotalCount = true; entityQuery.Where(p => Id >= 1 && p.Id <= 50).Skip(0).Take(10);

我正在使用RiaServices使用EntityQuery填充网格

因为我的数据库有数百万行,所以我只想查询当前页面,还要查询总行数,以便分页

例:共100行

entityQuery.Skip(0).Take(10); //for the first page
entityQuery.IncludeTotalCount = true;
entityQuery.Where(p => Id >= 1 && p.Id <= 50).Skip(0).Take(10); //with filter now
entityQuery.IncludeTotalCount = true;
这就得到了10行,loadOperation.TotalEntityCount=100。太好了

但想象一下:

例:共100行

entityQuery.Skip(0).Take(10); //for the first page
entityQuery.IncludeTotalCount = true;
entityQuery.Where(p => Id >= 1 && p.Id <= 50).Skip(0).Take(10); //with filter now
entityQuery.IncludeTotalCount = true;

entityQuery.Where(p=>Id>=1&&p.IdRIA服务通过剥离skip/take分页指令来处理总计数请求(如您所料)并将未分页的查询传递给受保护的virtual DomainService.Count方法。我建议重写此方法,设置断点,以便您可以验证是否将正确的计数查询传递给您的服务。如果您使用的是EF DomainService,则Count的基本实现将只执行一个查询。Count().所以事情应该按照你的预期进行-我还不确定为什么没有。你使用的是什么类型的域名服务?

哦,该死,我很久以前就推翻了这个方法,完全忘记了它的存在…我在那里设置了一个断点,然后发现了错误。Tks。出于某种原因,我一直得到-1.我如何在服务器上工作?