IQueryProvider.CreateQuery 方法

定義

多載

CreateQuery(Expression)

建構 IQueryable 物件,這個物件可評估由指定的運算式樹狀架構所表示的查詢。Constructs an IQueryable object that can evaluate the query represented by a specified expression tree.

CreateQuery<TElement>(Expression)

建構 IQueryable<T> 物件,這個物件可評估由指定的運算式樹狀架構所表示的查詢。Constructs an IQueryable<T> object that can evaluate the query represented by a specified expression tree.

CreateQuery(Expression)

建構 IQueryable 物件,這個物件可評估由指定的運算式樹狀架構所表示的查詢。Constructs an IQueryable object that can evaluate the query represented by a specified expression tree.

public:
 System::Linq::IQueryable ^ CreateQuery(System::Linq::Expressions::Expression ^ expression);
public System.Linq.IQueryable CreateQuery (System.Linq.Expressions.Expression expression);
abstract member CreateQuery : System.Linq.Expressions.Expression -> System.Linq.IQueryable
Public Function CreateQuery (expression As Expression) As IQueryable

參數

expression
Expression

表示 LINQ 查詢的運算式樹狀架構。An expression tree that represents a LINQ query.

傳回

IQueryable

IQueryable,可評估由指定的運算式樹狀架構所表示的查詢。An IQueryable that can evaluate the query represented by the specified expression tree.

備註

注意

Expression傳回之物件的屬性 IQueryable 等於 expressionThe Expression property of the returned IQueryable object is equal to expression.

CreateQuery方法是用來建立新的 IQueryable 物件,並提供運算式樹狀架構。The CreateQuery method is used to create new IQueryable objects, given an expression tree. 傳回的物件所代表的查詢會與特定的 LINQ 提供者相關聯。The query that is represented by the returned object is associated with a specific LINQ provider.

中定義的數個標準查詢運算子方法( Queryable 例如 OfType 和)會 Cast 呼叫這個方法。Several of the standard query operator methods defined in Queryable, such as OfType and Cast, call this method. 它們會將代表 LINQ 查詢的傳遞給它 MethodCallExpressionThey pass it a MethodCallExpression that represents a LINQ query.

適用於

CreateQuery<TElement>(Expression)

建構 IQueryable<T> 物件,這個物件可評估由指定的運算式樹狀架構所表示的查詢。Constructs an IQueryable<T> object that can evaluate the query represented by a specified expression tree.

public:
generic <typename TElement>
 System::Linq::IQueryable<TElement> ^ CreateQuery(System::Linq::Expressions::Expression ^ expression);
public System.Linq.IQueryable<TElement> CreateQuery<TElement> (System.Linq.Expressions.Expression expression);
abstract member CreateQuery : System.Linq.Expressions.Expression -> System.Linq.IQueryable<'Element>
Public Function CreateQuery(Of TElement) (expression As Expression) As IQueryable(Of TElement)

類型參數

TElement

所傳回 IQueryable<T> 之項目的型別。The type of the elements of the IQueryable<T> that is returned.

參數

expression
Expression

表示 LINQ 查詢的運算式樹狀架構。An expression tree that represents a LINQ query.

傳回

IQueryable<TElement>

IQueryable<T>,可評估由指定的運算式樹狀架構所表示的查詢。An IQueryable<T> that can evaluate the query represented by the specified expression tree.

備註

注意

Expression傳回之物件的屬性 IQueryable<T> 等於 expressionThe Expression property of the returned IQueryable<T> object is equal to expression.

CreateQuery方法是用來建立新的 IQueryable<T> 物件,並提供運算式樹狀架構。The CreateQuery method is used to create new IQueryable<T> objects, given an expression tree. 傳回的物件所代表的查詢會與特定的 LINQ 提供者相關聯。The query that is represented by the returned object is associated with a specific LINQ provider.

大部分會傳回 Queryable 可列舉結果的標準查詢運算子方法都會呼叫這個方法。Most of the Queryable standard query operator methods that return enumerable results call this method. 它們會將代表 LINQ 查詢的傳遞給它 MethodCallExpressionThey pass it a MethodCallExpression that represents a LINQ query.

適用於