From 9a94b91e3c3c4771b0091e04c28ade5d44cbba75 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Thu, 10 Aug 2023 18:15:31 +0200 Subject: [PATCH] Tiny cleanup --- .../Internal/NpgsqlDateTimeMethodTranslator.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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