Skip to content

Commit

Permalink
code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven.Darby authored and Steven.Darby committed Mar 25, 2023
1 parent 37cd3a1 commit af1b68e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ protected override Expression VisitExtension(Expression extensionExpression)
// Apply defining query only when it is not custom query root
&& entityQueryRootExpression.GetType() == typeof(EntityQueryRootExpression))
{
var processedDefiningQueryBody = _parameterExtractingExpressionVisitor.ExtractParameters(definingQuery.Body);
var processedDefiningQueryBody = _parameterExtractingExpressionVisitor.ExtractParameters(definingQuery.Body, false);
processedDefiningQueryBody = _queryTranslationPreprocessor.NormalizeQueryableMethod(processedDefiningQueryBody);
processedDefiningQueryBody = _nullCheckRemovingExpressionVisitor.Visit(processedDefiningQueryBody);
processedDefiningQueryBody =
Expand Down Expand Up @@ -1711,7 +1711,7 @@ private Expression ApplyQueryFilter(IEntityType entityType, NavigationExpansionE
if (!_parameterizedQueryFilterPredicateCache.TryGetValue(rootEntityType, out var filterPredicate))
{
filterPredicate = queryFilter;
filterPredicate = (LambdaExpression)_parameterExtractingExpressionVisitor.ExtractParameters(filterPredicate);
filterPredicate = (LambdaExpression)_parameterExtractingExpressionVisitor.ExtractParameters(filterPredicate, false);
filterPredicate = (LambdaExpression)_queryTranslationPreprocessor.NormalizeQueryableMethod(filterPredicate);

// We need to do entity equality, but that requires a full method call on a query root to properly flow the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,15 @@ public ParameterExtractingExpressionVisitor(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Expression ExtractParameters(Expression expression)
=> ExtractParameters(expression, clearEvaluatedValues: !_generateContextAccessors);
=> ExtractParameters(expression, clearEvaluatedValues: true);

private Expression ExtractParameters(Expression expression, bool clearEvaluatedValues)
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Expression ExtractParameters(Expression expression, bool clearEvaluatedValues)
{
var oldEvaluatableExpressions = _evaluatableExpressions;
_evaluatableExpressions = _evaluatableExpressionFindingExpressionVisitor.Find(expression);
Expand Down

0 comments on commit af1b68e

Please sign in to comment.