From 6201a09de6f5551206a07aab315d60e8cbfcdc4b Mon Sep 17 00:00:00 2001 From: Mohamed Seada Date: Fri, 27 Dec 2024 19:35:21 +0200 Subject: [PATCH] fix type validation condition --- .../Internal/Translators/SqlServerJsonFunctionsTranslator.cs | 2 +- .../Query/Internal/Translators/SqliteJsonFunctionsTranslator.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EFCore.SqlServer/Query/Internal/Translators/SqlServerJsonFunctionsTranslator.cs b/src/EFCore.SqlServer/Query/Internal/Translators/SqlServerJsonFunctionsTranslator.cs index 1d9d49a3292..6568ab2a094 100644 --- a/src/EFCore.SqlServer/Query/Internal/Translators/SqlServerJsonFunctionsTranslator.cs +++ b/src/EFCore.SqlServer/Query/Internal/Translators/SqlServerJsonFunctionsTranslator.cs @@ -47,7 +47,7 @@ public SqlServerJsonFunctionsTranslator(ISqlExpressionFactory sqlExpressionFacto IDiagnosticsLogger logger) { if (JsonExistsMethodInfo.Equals(method) - && arguments[0].TypeMapping is not SqlServerOwnedJsonTypeMapping and not StringTypeMapping + && arguments[0].TypeMapping is SqlServerOwnedJsonTypeMapping or StringTypeMapping && _sqlServerSingletonOptions.EngineType == SqlServerEngineType.SqlServer && _sqlServerSingletonOptions.SqlServerCompatibilityLevel >= 160) { diff --git a/src/EFCore.Sqlite.Core/Query/Internal/Translators/SqliteJsonFunctionsTranslator.cs b/src/EFCore.Sqlite.Core/Query/Internal/Translators/SqliteJsonFunctionsTranslator.cs index 15ad78774f4..712814e4d85 100644 --- a/src/EFCore.Sqlite.Core/Query/Internal/Translators/SqliteJsonFunctionsTranslator.cs +++ b/src/EFCore.Sqlite.Core/Query/Internal/Translators/SqliteJsonFunctionsTranslator.cs @@ -44,7 +44,7 @@ public SqliteJsonFunctionsTranslator(ISqlExpressionFactory sqlExpressionFactory) IDiagnosticsLogger logger) { if (JsonExistsMethodInfo.Equals(method) - && arguments[0].TypeMapping is not SqliteJsonTypeMapping and not StringTypeMapping) + && arguments[0].TypeMapping is SqliteJsonTypeMapping or StringTypeMapping) { // IIF(arguments_0 IS NULL, NULL, JSON_TYPE(arguments_0, arguments_1) IS NOT NULL) return _sqlExpressionFactory.Function("IFF",