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

参数

expression
Expression

表示 LINQLINQ 查询的表达式目录树。An expression tree that represents a LINQLINQ query.

返回

一个 IQueryable,它可计算指定表达式树所表示的查询。An IQueryable that can evaluate the query represented by the specified expression tree.

注解

备注

返回的 IQueryable 对象的 Expression 属性等于 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中定义的多个标准查询运算符方法(如 OfTypeCast)调用此方法。Several of the standard query operator methods defined in Queryable, such as OfType and Cast, call this method. 它们向其传递一个表示 LINQLINQ 查询的 MethodCallExpressionThey pass it a MethodCallExpression that represents a LINQLINQ 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>

类型参数

TElement

返回的 IQueryable<T> 的元素的类型。The type of the elements of the IQueryable<T> that is returned.

参数

expression
Expression

表示 LINQLINQ 查询的表达式目录树。An expression tree that represents a LINQLINQ query.

返回

IQueryable<TElement>

一个 IQueryable<T>,它可计算指定表达式树所表示的查询。An IQueryable<T> that can evaluate the query represented by the specified expression tree.

注解

备注

返回的 IQueryable<T> 对象的 Expression 属性等于 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. 它们向其传递一个表示 LINQLINQ 查询的 MethodCallExpressionThey pass it a MethodCallExpression that represents a LINQLINQ query.

适用于