Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/EFCore.Cosmos/Query/Internal/StringMethodTranslator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ private static readonly MethodInfo _endsWithMethodInfo

private static readonly MethodInfo _toLowerMethodInfo
= typeof(string).GetRequiredRuntimeMethod(nameof(string.ToLower), Array.Empty<Type>());

private static readonly MethodInfo _toUpperMethodInfo
= typeof(string).GetRequiredRuntimeMethod(nameof(string.ToUpper), Array.Empty<Type>());

private static readonly MethodInfo _firstOrDefaultMethodInfoWithoutArgs
= typeof(Enumerable).GetRuntimeMethods().Single(
Expand Down Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -606,15 +606,14 @@ 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);

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)
Expand Down