Share via


EntityQuery 제네릭 클래스

엔터티 컬렉션에 대한 LINQ 쿼리를 나타냅니다.

네임스페이스: System.ServiceModel.DomainServices.Client
어셈블리: system.servicemodel.domainservices.client.dll의 System.ServiceModel.DomainServices.Client

사용법

‘사용 방법
Dim instance As EntityQuery(Of TEntity)

구문

‘선언
Public NotInheritable Class EntityQuery(Of TEntity As Entity)
    Inherits EntityQuery
public sealed class EntityQuery<TEntity> : EntityQuery where TEntity : Entity
generic<typename TEntity> where TEntity : Entity
public ref class EntityQuery sealed : public EntityQuery

GenericParameters

  • TEntity
    엔터티 형식입니다.

예제

다음 코드에서는 도메인 서비스에서 고객을 검색하는 방법을 보여 줍니다. 이 코드는 전화 번호가 583으로 시작하는 고객을 필터링하고 LastName의 사전순으로 정렬합니다. 결과는 DataGrid에 표시됩니다.

Partial Public Class MainPage
    Inherits UserControl

    Private _customerContext As New CustomerDomainContext

    Public Sub New()
        InitializeComponent()

        Dim query As EntityQuery(Of Customer)

        query = _
            From c In Me._customerContext.GetCustomersQuery() _
            Where c.Phone.StartsWith("583") _
            Order By c.LastName

        Dim loadOp = Me._customerContext.Load(query)
        CustomerGrid.ItemsSource = loadOp.Entities
    End Sub

End Class
public partial class MainPage : UserControl
{
    private CustomerDomainContext _customerContext = new CustomerDomainContext();

    public MainPage()
    {
        InitializeComponent();
        EntityQuery<Customer> query = 
            from c in _customerContext.GetCustomersQuery()
            where c.Phone.StartsWith("583")
            orderby c.LastName
            select c;
        LoadOperation<Customer> loadOp = this._customerContext.Load(query);
        CustomerGrid.ItemsSource = loadOp.Entities;
    }
}

설명

클라이언트 응용 프로그램에서 쿼리에 추가 필터를 적용하여 반환되는 엔터티를 제한할 수 있습니다. LINQ 및 LINQ 쿼리 연산자의 하위 집합을 사용하여 쿼리에서 반환되는 결과를 수정합니다. 다음은 사용 가능한 쿼리 연산자입니다.

  • Where

  • OrderBy

  • ThenBy

  • Skip

  • Take

추가 필터를 적용한 후 EntityQuery 개체를 Load 메서드의 매개 변수로 전달하여 쿼리를 실행하고 결과를 가져옵니다. 쿼리에 IsComposable 속성이 false로 설정된 QueryAttribute가 있는 경우 쿼리에 추가 필터를 적용할 수 없습니다. 일반적으로 한 개의 엔터티를 반환하는 쿼리에서만 IsComposablefalse로 설정됩니다.

상속 계층

System.Object
   System.ServiceModel.DomainServices.Client.EntityQuery
    System.ServiceModel.DomainServices.Client.EntityQuery

스레드 보안

이 형식의 모든 public static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 모든 인스턴스 멤버는 스레드로부터 안전하지 않을 수 있습니다.

플랫폼

개발 플랫폼

Windows XP Home Edition, Windows XP Professional, Windows Server 2003 , Windows Server 2008 및 Windows 2000

대상 플랫폼

Change History

참고 항목

참조

EntityQuery 멤버
System.ServiceModel.DomainServices.Client 네임스페이스