This documentation is archived and is not being maintained.

DataServiceQueryContinuation(Of T) Class

Encapsulates a URI that returns the next page of a paged query result.

Namespace:  System.Data.Services.Client
Assembly:  System.Data.Services.Client (in System.Data.Services.Client.dll)

'Declaration
Public NotInheritable Class DataServiceQueryContinuation(Of T) _
	Inherits DataServiceQueryContinuation
'Usage
Dim instance As DataServiceQueryContinuation(Of T)

Type Parameters

T

The type of continuation token.

This topic describes new functionality in ADO.NET Data Services that is available as an update to the .NET Framework version 3.5 Service Pack 1. You can download and install the update from the Microsoft Download Center.

This example uses a do…while loop to load Customers entities from a paged results from the data service.

' Create the DataServiceContext using the service URI. 
Dim context = New NorthwindEntities(svcUri)
Dim token As DataServiceQueryContinuation(Of Customers) = Nothing 
Dim pageCount = 0

Try 
    ' Execute the query for all customers and get the response object. 
    Dim response As QueryOperationResponse(Of Customers) = _
        CType(context.Customers.Execute(), QueryOperationResponse(Of Customers))

    ' With a paged response from the service, use a do...while loop  
    ' to enumerate the results before getting the next link.
    Do
        ' Write the page number.
        Console.WriteLine("Page {0}:", pageCount + 1)

        ' If nextLink is not null, then there is a new page to load. 
        If token IsNot Nothing Then 
            ' Load the new page from the next link URI.
            response = CType(context.Execute(Of Customers)(token),  _
            QueryOperationResponse(Of Customers))
        End If 

        ' Enumerate the customers in the response. 
        For Each customer As Customers In response
            Console.WriteLine("\tCustomer Name: {0}", customer.CompanyName)
        Next 

        ' Get the next link, and continue while there is a next link.
        token = response.GetContinuation()
    Loop While token IsNot Nothing 
Catch ex As DataServiceQueryException
    Throw New ApplicationException( _
            "An error occurred during query execution.", ex)
End Try

System.Object
  System.Data.Services.Client.DataServiceQueryContinuation
    System.Data.Services.Client.DataServiceQueryContinuation(Of T)

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5 SP1
Show: