diff --git a/src/EFCore.Cosmos/Query/Internal/StringMethodTranslator.cs b/src/EFCore.Cosmos/Query/Internal/StringMethodTranslator.cs index dc21aa2926d..9a7eab5e116 100644 --- a/src/EFCore.Cosmos/Query/Internal/StringMethodTranslator.cs +++ b/src/EFCore.Cosmos/Query/Internal/StringMethodTranslator.cs @@ -32,6 +32,9 @@ private static readonly MethodInfo _endsWithMethodInfo private static readonly MethodInfo _toLowerMethodInfo = typeof(string).GetRequiredRuntimeMethod(nameof(string.ToLower), Array.Empty()); + + private static readonly MethodInfo _toUpperMethodInfo + = typeof(string).GetRequiredRuntimeMethod(nameof(string.ToUpper), Array.Empty()); private static readonly MethodInfo _firstOrDefaultMethodInfoWithoutArgs = typeof(Enumerable).GetRuntimeMethods().Single( @@ -105,6 +108,11 @@ public StringMethodTranslator([NotNull] ISqlExpressionFactory sqlExpressionFacto { return TranslateSystemFunction("LOWER", method.ReturnType, instance); } + + if (_toUpperMethodInfo.Equals(method)) + { + return TranslateSystemFunction("UPPER", method.ReturnType, instance); + } } if (_firstOrDefaultMethodInfoWithoutArgs.Equals(method)) diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindFunctionsQueryCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindFunctionsQueryCosmosTest.cs index dd1daa52a21..4e249d0df3c 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindFunctionsQueryCosmosTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindFunctionsQueryCosmosTest.cs @@ -606,7 +606,6 @@ FROM root c WHERE (c[""Discriminator""] = ""OrderDetail"")"); } - [ConditionalTheory(Skip = "Issue #17246")] public override async Task Where_string_to_upper(bool async) { await base.Where_string_to_upper(async); @@ -614,7 +613,7 @@ public override async Task Where_string_to_upper(bool async) AssertSql( @"SELECT c FROM root c -WHERE (c[""Discriminator""] = ""Customer"")"); +WHERE ((c[""Discriminator""] = ""Customer"") AND (UPPER(c[""CustomerID""]) = ""ALFKI""))"); } public override async Task Where_string_to_lower(bool async)