private bool TryRewrite(SubQueryExpression subQueryExpression, bool forceToListResult, out Expression result) { if (_queryCompilationContext.TryGetCorrelatedSubqueryMetadata(subQueryExpression.QueryModel.MainFromClause, out var correlatedSubqueryMetadata)) { var parentQsre = new QuerySourceReferenceExpression(correlatedSubqueryMetadata.ParentQuerySource); result = Rewrite( correlatedSubqueryMetadata.Index, subQueryExpression.QueryModel, correlatedSubqueryMetadata.CollectionNavigation, correlatedSubqueryMetadata.TrackingQuery, parentQsre, forceToListResult); return(true); } result = null; return(false); }
private bool TryRewrite(SubQueryExpression subQueryExpression, bool forceToListResult, Type listResultElementType, out Expression result) { if (_queryCompilationContext.TryGetCorrelatedSubqueryMetadata(subQueryExpression.QueryModel.MainFromClause, out var correlatedSubqueryMetadata) && subQueryExpression.QueryModel.BodyClauses.OfType <WhereClause>() .Any(c => c.Predicate is NullSafeEqualExpression)) { var parentQsre = new QuerySourceReferenceExpression(correlatedSubqueryMetadata.ParentQuerySource); result = Rewrite( correlatedSubqueryMetadata.Index, subQueryExpression.QueryModel, correlatedSubqueryMetadata.CollectionNavigation, correlatedSubqueryMetadata.TrackingQuery, parentQsre, forceToListResult, listResultElementType); return(true); } result = null; return(false); }