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

속성 값

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

예외

잘못된 값을 설정하도록 지정한 경우

예제

다음은 첫 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 메서드의 조인에서 현재 시퀀스를 참조할 때 유용할 수 있습니다. 자세한 내용은 쿼리 작성기 메서드합니다.

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

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

적용 대상

추가 정보