다음을 통해 공유


ObjectQuery<T>.Name 속성

정의

이 개체 쿼리의 이름을 가져오거나 설정합니다.

public:
 property System::String ^ Name { System::String ^ get(); void set(System::String ^ value); };
public string Name { get; set; }
member this.Name : string with get, set
Public Property Name As String

속성 값

stringObjectQuery<T>값의 이름인 값입니다.

예외

집합에 지정된 값이 잘못되었습니다.

예제

다음은 첫 번째 ObjectQuery<T> 이름을 "product"로 설정한 다음 이 별칭을 연속 OrderBy 메서드에서 사용하는 예제입니다.

int cost = 10;
// Return Product objects with a standard cost
// above 10 dollars.
ObjectQuery<Product> productQuery =
    context.Products
    .Where("it.StandardCost > @cost", new ObjectParameter("cost", cost));

// Set the Name property for the query and then
// use that name as the alias in the subsequent
// OrderBy method.
productQuery.Name = "product";
ObjectQuery<Product> filteredProduct = productQuery
    .OrderBy("product.ProductID");

설명

쿼리 작성기 메서드를 생성할 때 개체 쿼리의 이름은 시퀀스의 현재 개체 쿼리를 이름으로 식별합니다. 기본적으로 쿼리 이름은 .입니다 it. 메서드 내부 Where 또는 SelectValue 메서드의 조인에서 현재 시퀀스를 참조할 때 유용할 수 있습니다. 자세한 내용은 쿼리 작성기 메서드를 참조하세요.

속성을 ObjectQuery<T>설정 Name 하면 해당 값이 연속 메서드의 별칭이 됩니다.

속성 값 Name 은 문자로 시작해야 하며 문자, 숫자 및 밑줄을 포함할 수 있습니다.

적용 대상

추가 정보