IQueryProvider.Execute 方法

定義

多載

Execute(Expression)

執行指定之運算式樹狀架構所代表的查詢。Executes the query represented by a specified expression tree.

Execute<TResult>(Expression)

執行由指定之運算式樹狀架構所代表的強型別查詢。Executes the strongly-typed query represented by a specified expression tree.

Execute(Expression)

執行指定之運算式樹狀架構所代表的查詢。Executes the query represented by a specified expression tree.

public:
 System::Object ^ Execute(System::Linq::Expressions::Expression ^ expression);
public object Execute (System.Linq.Expressions.Expression expression);
public object? Execute (System.Linq.Expressions.Expression expression);
abstract member Execute : System.Linq.Expressions.Expression -> obj
Public Function Execute (expression As Expression) As Object

參數

expression
Expression

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

傳回

Object

執行指定的查詢所產生的值。The value that results from executing the specified query.

備註

Execute方法會執行傳回單一值的查詢, (而不是) 的可列舉值序列。The Execute method executes queries that return a single value (instead of an enumerable sequence of values). 當列舉相關聯的物件時,會執行代表傳回可列舉結果之查詢的運算式樹狀架構 IQueryableExpression trees that represent queries that return enumerable results are executed when their associated IQueryable object is enumerated.

適用於

Execute<TResult>(Expression)

執行由指定之運算式樹狀架構所代表的強型別查詢。Executes the strongly-typed query represented by a specified expression tree.

public:
generic <typename TResult>
 TResult Execute(System::Linq::Expressions::Expression ^ expression);
public TResult Execute<TResult> (System.Linq.Expressions.Expression expression);
abstract member Execute : System.Linq.Expressions.Expression -> 'Result
Public Function Execute(Of TResult) (expression As Expression) As TResult

類型參數

TResult

執行查詢所產生值的型別。The type of the value that results from executing the query.

參數

expression
Expression

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

傳回

TResult

執行指定的查詢所產生的值。The value that results from executing the specified query.

備註

Execute方法會執行傳回單一值的查詢, (而不是) 的可列舉值序列。The Execute method executes queries that return a single value (instead of an enumerable sequence of values). 代表傳回可列舉結果之查詢的運算式樹狀架構,會在 IQueryable<T> 列舉包含運算式樹狀架構的物件時執行。Expression trees that represent queries that return enumerable results are executed when the IQueryable<T> object that contains the expression tree is enumerated.

傳回 Queryable 單一結果呼叫的標準查詢運算子方法 ExecuteThe Queryable standard query operator methods that return singleton results call Execute. 它們會將代表 LINQ 查詢的傳遞給它 MethodCallExpressionThey pass it a MethodCallExpression that represents a LINQ query.

適用於