DataServiceCollection<T>.Continuation 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
다음 페이징된 결과 집합을 반환하는 데 사용되는 연속 개체를 가져옵니다.
public:
property System::Data::Services::Client::DataServiceQueryContinuation<T> ^ Continuation { System::Data::Services::Client::DataServiceQueryContinuation<T> ^ get(); void set(System::Data::Services::Client::DataServiceQueryContinuation<T> ^ value); };
public System.Data.Services.Client.DataServiceQueryContinuation<T> Continuation { get; set; }
member this.Continuation : System.Data.Services.Client.DataServiceQueryContinuation<'T> with get, set
Public Property Continuation As DataServiceQueryContinuation(Of T)
속성 값
다음 페이징된 결과 집합을 반환할 URI가 포함된 DataServiceQueryContinuation<T> 개체입니다.
예제
다음 예제는 WPF에서 창을 정의하는 SalesOrders
XAML(Extensible Application Markup Language) 페이지의 코드 숨김 페이지에서 가져옵니다. 창이 로드되면 국가를 기준으로 필터링된 DataServiceCollection<T> 고객을 반환하는 쿼리의 결과에 따라 가 만들어집니다. 이 페이징된 결과의 모든 페이지는 관련 순서와 함께 로드되며 WPF 창의 루트 레이아웃 컨트롤인 의 StackPanel 속성에 바인딩 DataContext 됩니다. 자세한 내용은 방법: Windows Presentation Foundation 요소에 데이터 바인딩을 참조하세요.
using System;
using System.Data.Services.Client;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using NorthwindClient.Northwind;
namespace NorthwindClient
{
public partial class CustomerOrdersWpf3 : Window
{
private NorthwindEntities context;
private DataServiceCollection<Customer> trackedCustomers;
private const string customerCountry = "Germany";
private const string svcUri = "http://localhost:12345/Northwind.svc/";
public CustomerOrdersWpf3()
{
//InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
try
{
// Initialize the context for the data service.
context = new NorthwindEntities(new Uri(svcUri));
// Create a LINQ query that returns customers with related orders.
var customerQuery = from cust in context.Customers
where cust.Country == customerCountry
select cust;
// Create a new collection for binding based on the LINQ query.
trackedCustomers = new DataServiceCollection<Customer>(customerQuery);
// Load all pages of the response at once.
while (trackedCustomers.Continuation != null)
{
trackedCustomers.Load(
context.Execute<Customer>(trackedCustomers.Continuation.NextLinkUri));
}
// Bind the root StackPanel element to the collection;
// related object binding paths are defined in the XAML.
LayoutRoot.DataContext = trackedCustomers;
}
catch (DataServiceQueryException ex)
{
MessageBox.Show("The query could not be completed:\n" + ex.ToString());
}
catch (InvalidOperationException ex)
{
MessageBox.Show("The following error occurred:\n" + ex.ToString());
}
}
private void customerIDComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Customer selectedCustomer =
this.customerIDComboBox.SelectedItem as Customer;
try
{
// Load the first page of related orders for the selected customer.
context.LoadProperty(selectedCustomer, "Orders");
// Load all remaining pages.
while (selectedCustomer.Orders.Continuation != null)
{
selectedCustomer.Orders.Load(
context.Execute<Order>(selectedCustomer.Orders.Continuation.NextLinkUri));
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void saveChangesButton_Click(object sender, RoutedEventArgs e)
{
try
{
// Save changes to the data service.
context.SaveChanges();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
}
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Navigation
Imports System.Windows.Shapes
Imports System.Data.Services.Client
Imports NorthwindClient.Northwind
Partial Public Class CustomerOrdersWpf3
Inherits Window
Private context As NorthwindEntities
Private trackedCustomers As DataServiceCollection(Of Customer)
Private Const customerCountry As String = "Germany"
Private Const svcUri As String = "http://localhost:12345/Northwind.svc/"
Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
Try
' Initialize the context for the data service.
context = New NorthwindEntities(New Uri(svcUri))
' Create a LINQ query that returns customers with related orders.
Dim customerQuery = From cust In context.Customers _
Where cust.Country = customerCountry _
Select cust
' Create a new collection for binding based on the LINQ query.
trackedCustomers = New DataServiceCollection(Of Customer)(customerQuery)
' Load all pages of the response at once.
While trackedCustomers.Continuation IsNot Nothing
trackedCustomers.Load( _
context.Execute(Of Customer)(trackedCustomers.Continuation.NextLinkUri))
End While
' Bind the root StackPanel element to the collection
' related object binding paths are defined in the XAML.
Me.LayoutRoot.DataContext = trackedCustomers
Catch ex As DataServiceQueryException
MessageBox.Show("The query could not be completed:\n" + ex.ToString())
Catch ex As InvalidOperationException
MessageBox.Show("The following error occurred:\n" + ex.ToString())
End Try
End Sub
Private Sub customerIDComboBox_SelectionChanged(ByVal sender As Object, ByVal e As SelectionChangedEventArgs)
Dim selectedCustomer As Customer = _
CType(Me.customerIDComboBox.SelectedItem, Customer)
Try
If selectedCustomer.Orders.Count = 0 Then
' Load the first page of related orders for the selected customer.
context.LoadProperty(selectedCustomer, "Orders")
End If
' Load all remaining pages.
While selectedCustomer.Orders.Continuation IsNot Nothing
selectedCustomer.Orders.Load( _
context.Execute(Of Order)(selectedCustomer.Orders.Continuation.NextLinkUri))
End While
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
End Sub
Private Sub saveChangesButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
Try
' Save changes to the data service.
context.SaveChanges()
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
End Sub
End Class
설명
속성은 Continuation 데이터 서비스에서 페이징을 사용할 때 페이징된 결과의 다음 집합에 액세스하는 데 사용되는 링크를 반환합니다. 자세한 내용은 데이터 서비스 구성합니다.
페이징된 결과를 로 DataServiceCollection<T>로드할 때는 속성에서 Continuation 가져온 URI 실행 결과를 전달하여 에서 DataServiceCollection<T> 메서드를 호출 Load(IEnumerable<T>) 하여 페이지를 명시적으로 로드해야 합니다.
적용 대상
추가 정보
.NET