IQueryProvider Interface
IQueryable. This interface is used by the LINQ infrastructure to query objects that implement IQueryable.
Syntax
public interface IQueryProvider
Remarks
An IQueryProvider is responsible for translating an expression tree into a query that can be executed. It takes an Expression object and returns a result. The LINQ infrastructure uses this interface to execute queries against data sources that support query processing.
When you create an IQueryable object, an IQueryProvider is typically associated with it. This provider is then used to execute the LINQ query represented by the expression tree associated with the IQueryable object.
Methods
TResult Execute<TResult>(Expression expression)
Executes the query represented by a specific expression tree.
Parameters
- expression
- An expression tree that represents a LINQ query.
Returns
The result of executing the query.
IQueryable<TElement> CreateQuery<TElement>(Expression expression)
Constructs an IQueryable object that can evaluate the query represented by the specified expression tree.
Parameters
- expression
- An expression tree that represents a LINQ query.
Returns
An IQueryable object that can evaluate the query represented by the specified expression tree.
object Execute(Expression expression)
Executes the query represented by a specific expression tree.
Parameters
- expression
- An expression tree that represents a LINQ query.
Returns
The result of executing the query.
IQueryable CreateQuery(Expression expression)
Constructs an IQueryable object that can evaluate the query represented by the specified expression tree.
Parameters
- expression
- An expression tree that represents a LINQ query.
Returns
An IQueryable object that can evaluate the query represented by the specified expression tree.