src/Shared/EntityFramework/Core/Objects/ObjectQuery`.cs
// <summary>
// Retrieves the LINQ expression that backs this ObjectQuery for external consumption.
// It is important that the work to wrap the expression in an appropriate MergeAs call
// takes place in this method and NOT in ObjectQueryState.TryGetExpression which allows
// the unmodified expression (that does not include the MergeOption-preserving MergeAs call)
// to be retrieved and processed by the ELinq ExpressionConverter.
// </summary>
// <returns> The LINQ expression for this ObjectQuery, wrapped in a MergeOption-preserving call to the MergeAs method if the ObjectQuery.MergeOption property has been set. </returns>
Retrieves the LINQ expression that backs this ObjectQuery for external consumption.
It is important that the work to wrap the expression in an appropriate MergeAs call
takes place in this method and NOT in ObjectQueryState.TryGetExpression which allows
the unmodified expression (that does not include the MergeOption-preserving MergeAs call)
to be retrieved and processed by the ELinq ExpressionConverter.
Retrieves the LINQ expression that backs this ObjectQuery for external consumption . It is important that the work to wrap the expression in an appropriate MergeAs call takes place in this method and NOT in ObjectQueryState . TryGetExpression which allows the unmodified expression ( that does not include the MergeOption - preserving MergeAs call ) to be retrieved and processed by the ELinq ExpressionConverter .
internal override Expression GetExpression()
        {
            Expression retExpr;
            if (!QueryState.TryGetExpression(out retExpr))
            {
                retExpr = Expression.Constant(this);
            }
            if (QueryState.UserSpecifiedMergeOption.HasValue)
            {
                retExpr = TypeSystem.EnsureType(retExpr, typeof(ObjectQuery<T>));
                retExpr = Expression.Call(retExpr, MergeAsMethod, Expression.Constant(QueryState.UserSpecifiedMergeOption.Value));
            }
            if (null != QueryState.Span)
            {
                retExpr = TypeSystem.EnsureType(retExpr, typeof(ObjectQuery<T>));
                retExpr = Expression.Call(retExpr, IncludeSpanMethod, Expression.Constant(QueryState.Span));
            }
            return retExpr;
        }
internal override Expression GetExpression ( ) { Expression retExpr ; if ( ! QueryState . TryGetExpression ( out retExpr ) ) { retExpr = Expression . Constant ( this ) ; } if ( QueryState . UserSpecifiedMergeOption . HasValue ) { retExpr = TypeSystem . EnsureType ( retExpr , typeof ( ObjectQuery < T > ) ) ; retExpr = Expression . Call ( retExpr , MergeAsMethod , Expression . Constant ( QueryState . UserSpecifiedMergeOption . Value ) ) ; } if ( null != QueryState . Span ) { retExpr = TypeSystem . EnsureType ( retExpr , typeof ( ObjectQuery < T > ) ) ; retExpr = Expression . Call ( retExpr , IncludeSpanMethod , Expression . Constant ( QueryState . Span ) ) ; } return retExpr ; }
Retrieves the LINQ expression that backs this ObjectQuery for external consumption.
Retrieves the LINQ expression that backs this ObjectQuery for external consumption .
// If this ObjectQuery is not backed by a LINQ Expression (it is an ESQL query), // then create a ConstantExpression that uses this ObjectQuery as its value.
The LINQ expression for this ObjectQuery, wrapped in a MergeOption-preserving call to the MergeAs method if the ObjectQuery.MergeOption property has been set.
The LINQ expression for this ObjectQuery wrapped in a MergeOption - preserving call to the MergeAs method if the ObjectQuery . MergeOption property has been set .