0

我正在尝试通过我的 WCF 服务进行服务器端分页。我的代码仅获取 50 条记录并显示它们,但总数为 57 条记录,我无法分页到第二页查看它们。这是我的服务代码:

<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 条记录?

4

1 回答 1

0

我想出了如何传递我的记录总数。我刚刚添加了第二个参数到我的

ResponseArgs(of User())(curretGroup.Users.Skip(skip).Take(take).ToArray(), totalCount)

它奏效了!当然,我必须修改我的 ResponseArgs 类以允许 2 个参数。

于 2013-03-07T16:33:31.733 回答