in EFCore/src/Query/Expressions/Internal/MySQLStringComparisonMethodTranslator.cs [308:377]
public SqlExpression? MakeEndsWithExpression(
[NotNull] SqlExpression target,
[NotNull] SqlExpression suffix,
[NotNull] SqlExpression stringComparison)
{
if (TryGetExpressionValue<StringComparison>(stringComparison, out var cmp))
{
return CreateExpressionForCaseSensitivity(
cmp,
() =>
MakeEndsWithExpressionImpl(
target,
Utf8Bin(suffix),
suffix
),
() =>
MakeEndsWithExpressionImpl(
LCase(target),
Utf8Bin(LCase(suffix)),
suffix
)
);
}
else
{
#if !NET8_0_OR_GREATER
return new CaseExpression(
new[]
{
new CaseWhenClause(
_sqlExpressionFactory.In(stringComparison, _caseSensitiveComparisons, false),
// Case sensitive, accent sensitive
MakeEndsWithExpressionImpl(
target,
Utf8Bin(suffix),
suffix
)
)
},
// Case insensitive, accent sensitive
MakeEndsWithExpressionImpl(
LCase(target),
Utf8Bin(LCase(suffix)),
suffix
)
);
#else
return new CaseExpression(
new[]
{
new CaseWhenClause(
_sqlExpressionFactory.In(stringComparison,(IReadOnlyList<SqlExpression>) _caseSensitiveComparisons),
// Case sensitive, accent sensitive
MakeEndsWithExpressionImpl(
target,
Utf8Bin(suffix),
suffix
)
)
},
// Case insensitive, accent sensitive
MakeEndsWithExpressionImpl(
LCase(target),
Utf8Bin(LCase(suffix)),
suffix
)
);
#endif
}
}