diff --git a/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlDateTimeMethodTranslator.cs b/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlDateTimeMethodTranslator.cs index b85bfd44d..09245cee3 100644 --- a/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlDateTimeMethodTranslator.cs +++ b/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlDateTimeMethodTranslator.cs @@ -67,10 +67,14 @@ private static readonly MethodInfo TimeOnly_IsBetween private static readonly MethodInfo TimeOnly_Add_TimeSpan = typeof(TimeOnly).GetRuntimeMethod(nameof(TimeOnly.Add), new[] { typeof(TimeSpan) })!; - private static readonly MethodInfo TimeZoneInfo_ConvertTimeBySystemTimeZoneId + private static readonly MethodInfo TimeZoneInfo_ConvertTimeBySystemTimeZoneId_DateTime = typeof(TimeZoneInfo).GetRuntimeMethod( nameof(TimeZoneInfo.ConvertTimeBySystemTimeZoneId), new[] { typeof(DateTime), typeof(string) })!; + private static readonly MethodInfo TimeZoneInfo_ConvertTimeBySystemTimeZoneId_DateTimeOffset + = typeof(TimeZoneInfo).GetRuntimeMethod( + nameof(TimeZoneInfo.ConvertTimeBySystemTimeZoneId), new[] { typeof(DateTimeOffset), typeof(string) })!; + private static readonly MethodInfo TimeZoneInfo_ConvertTimeToUtc = typeof(TimeZoneInfo).GetRuntimeMethod(nameof(TimeZoneInfo.ConvertTimeToUtc), new[] { typeof(DateTime) })!; // ReSharper restore InconsistentNaming @@ -322,7 +326,7 @@ public NpgsqlDateTimeMethodTranslator( MethodInfo method, IReadOnlyList arguments) { - if (method == TimeZoneInfo_ConvertTimeBySystemTimeZoneId) + if (method == TimeZoneInfo_ConvertTimeBySystemTimeZoneId_DateTime) { var typeMapping = arguments[0].TypeMapping; if (typeMapping is null