我正在尝试通过我的WCF服务进行服务器端分页。我的代码只获得50条记录并显示它们,但总共有57条记录,我无法翻页到第2页查看它们。这是我的服务代码:
<OperationContract()>
Public Function QueryUsersForGroup(
ByVal authentication As AuthenticationArgs,
ByVal group As Guid,
ByVal skip As Integer,
ByVal take As Integer) As ResponseArgs(Of User())
Dim exception As ExceptionArgs = Nothing
If AuthenticationService.CheckPermissions(
authentication,
exception,
PermissionType.AdministerUserAccounts) Then
Dim model As CscModel = DataHelper.CreateModel()
Dim currentGroup = model.Groups.FirstOrDefault(Function(row) row.Id.Equals(group))
If currentGroup Is Nothing Then Return New ResponseArgs(Of User())(New User() {})
' This only returns 50 records since take is 50 from my callback
Return New ResponseArgs(Of User())(currentGroup.Users.Ship(skip).Take(take).ToArray())
Else
Return New ResponseArgs(Of User())(exception)
End If
End Function
我怎样才能传递记录的总数,也只能传递一次显示的50条记录?
答案 0 :(得分:0)
我想出了如何传递记录的总数。我刚刚在我的
中添加了第二个参数ResponseArgs(of User())(curretGroup.Users.Skip(skip).Take(take).ToArray(), totalCount)
它有效!当然,我必须修改我的ResponseArgs类以允许2个参数。