C# Class System.Data.Entity.Internal.Linq.DbQueryVisitor

A LINQ expression visitor that finds DbQuery uses with equivalent ObjectQuery instances.
Inheritance: System.Linq.Expressions.ExpressionVisitor
Exibir arquivo Open project: aspnet/EntityFramework6 Class Usage Examples

Protected Methods

Method Description
VisitMember ( MemberExpression node ) : Expression

Replaces a DbQuery or DbQuery{T} property with a constant expression for the underlying ObjectQuery.

VisitMethodCall ( MethodCallExpression node ) : Expression

Replaces calls to DbContext.Set() with an expression for the equivalent ObjectQuery.

Private Methods

Method Description
CreateObjectQueryConstant ( object dbQuery ) : Expression

Takes a DbQuery{T} or DbQuery and creates an expression for the underlying ObjectQuery{T}.

ExtractObjectQuery ( object dbQuery ) : System.Data.Entity.Core.Objects.ObjectQuery

Takes a DbQuery{T} or DbQuery and extracts the underlying ObjectQuery{T}.

GetContextFromConstantExpression ( Expression expression, MemberInfo member ) : DbContext

Gets a DbContext value from the given member, or returns null if the member doesn't contain a DbContext instance.

GetContextFromMember ( MemberInfo member, object value ) : DbContext

Gets the DbContext instance from the given instance or static member, returning null if the member does not contain a DbContext instance.

GetExpressionValue ( Expression expression ) : object

Tries to retrieve the value of an expression If the expression is a constant, it returns the constant value. If the expression is a field or property access on an expression, it returns the value of it recursively. Otherwise it returns null

Method Details

VisitMember() protected method

Replaces a DbQuery or DbQuery{T} property with a constant expression for the underlying ObjectQuery.
protected VisitMember ( MemberExpression node ) : Expression
node System.Linq.Expressions.MemberExpression The node to replace.
return System.Linq.Expressions.Expression

VisitMethodCall() protected method

Replaces calls to DbContext.Set() with an expression for the equivalent ObjectQuery.
protected VisitMethodCall ( MethodCallExpression node ) : Expression
node System.Linq.Expressions.MethodCallExpression The node to replace.
return System.Linq.Expressions.Expression