Duration (Pacific Standard Time):
To (Pacific Standard Time):
Impact:
  • None
User Action:
  • None

DataServiceQueryContinuation<T> Class

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

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

System.Object
  System.Data.Services.Client.DataServiceQueryContinuation
    System.Data.Services.Client.DataServiceQueryContinuation<T>

Public NotInheritable Class DataServiceQueryContinuation(Of T)
	Inherits DataServiceQueryContinuation

Type Parameters

T

The type of continuation token.

Name Description
System_CAPS_pubproperty NextLinkUri

Gets the URI that is used to return the next page of data from a paged query result.(Inherited from DataServiceQueryContinuation.)

Name Description
System_CAPS_pubmethod Equals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethod GetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethod GetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethod ToString()

Returns the next link URI as a string.(Inherited from DataServiceQueryContinuation.)

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 Customer) = Nothing
Dim pageCount = 0

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

    ' 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 Customer)(token),  _
            QueryOperationResponse(Of Customer))
        End If

        ' Enumerate the customers in the response.
        For Each customer As Customer In response
            Console.WriteLine(vbTab & "Customer 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
.NET Framework
Available since 3.5
Silverlight
Available since 4.0

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

Return to top