次の方法で共有


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値。

例外

set で指定された値が無効です。

次の使用例は、最初の 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 プロパティの値は文字で始まる必要があり、文字、数字、アンダースコアを含めることができます。

適用対象

こちらもご覧ください