From da46c5ae8d9b7527ffdb24bee3a801ee807fbc58 Mon Sep 17 00:00:00 2001 From: Laurents Meyer Date: Fri, 29 Sep 2023 22:12:22 +0200 Subject: [PATCH] Revert "Move MySqlCompatibilityExpressionVisitor from after to just before the query compilation." This reverts commit 4b1afd613cef1aeeb20296d863609ec1798f89bf. --- .../Internal/MySqlCompatibilityExpressionVisitor.cs | 1 + .../Internal/MySqlQueryTranslationPostprocessor.cs | 3 --- .../Query/Internal/MySqlParameterBasedSqlProcessor.cs | 3 +++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/EFCore.MySql/Query/ExpressionVisitors/Internal/MySqlCompatibilityExpressionVisitor.cs b/src/EFCore.MySql/Query/ExpressionVisitors/Internal/MySqlCompatibilityExpressionVisitor.cs index 228e027db..2d60cdd88 100644 --- a/src/EFCore.MySql/Query/ExpressionVisitors/Internal/MySqlCompatibilityExpressionVisitor.cs +++ b/src/EFCore.MySql/Query/ExpressionVisitors/Internal/MySqlCompatibilityExpressionVisitor.cs @@ -2,6 +2,7 @@ // Licensed under the MIT. See LICENSE in the project root for license information. using System; +using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using Microsoft.EntityFrameworkCore.Diagnostics; diff --git a/src/EFCore.MySql/Query/ExpressionVisitors/Internal/MySqlQueryTranslationPostprocessor.cs b/src/EFCore.MySql/Query/ExpressionVisitors/Internal/MySqlQueryTranslationPostprocessor.cs index a47ff0a8d..574e7e13b 100644 --- a/src/EFCore.MySql/Query/ExpressionVisitors/Internal/MySqlQueryTranslationPostprocessor.cs +++ b/src/EFCore.MySql/Query/ExpressionVisitors/Internal/MySqlQueryTranslationPostprocessor.cs @@ -36,9 +36,6 @@ public override Expression Process(Expression query) query = new MySqlBug96947WorkaroundExpressionVisitor(_sqlExpressionFactory).Visit(query); } - // Run the compatibility checks as late in the query translation pipeline as reasonable. - query = new MySqlCompatibilityExpressionVisitor(_options).Visit(query); - return query; } } diff --git a/src/EFCore.MySql/Query/Internal/MySqlParameterBasedSqlProcessor.cs b/src/EFCore.MySql/Query/Internal/MySqlParameterBasedSqlProcessor.cs index ad64c3944..c93b6ea9f 100644 --- a/src/EFCore.MySql/Query/Internal/MySqlParameterBasedSqlProcessor.cs +++ b/src/EFCore.MySql/Query/Internal/MySqlParameterBasedSqlProcessor.cs @@ -55,6 +55,9 @@ public override Expression Optimize( canCache &= canCache3; + // Run the compatibility checks as late in the query pipeline (before the actual SQL translation happens) as reasonable. + queryExpression = new MySqlCompatibilityExpressionVisitor(_options).Visit(queryExpression); + return queryExpression; }