Skip to content

Commit fdc4cca

Browse files
committed
Correct non-NodaTime date/time type mappings when NodaTime is configured (#3214)
Fixes #3213 (cherry picked from commit dba77fd)
1 parent 8a4c25b commit fdc4cca

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlDateTimeMemberTranslator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public class NpgsqlDateTimeMemberTranslator : IMemberTranslator
2727
public NpgsqlDateTimeMemberTranslator(IRelationalTypeMappingSource typeMappingSource, NpgsqlSqlExpressionFactory sqlExpressionFactory)
2828
{
2929
_typeMappingSource = typeMappingSource;
30-
_timestampMapping = typeMappingSource.FindMapping("timestamp without time zone")!;
31-
_timestampTzMapping = typeMappingSource.FindMapping("timestamp with time zone")!;
30+
_timestampMapping = typeMappingSource.FindMapping(typeof(DateTime), "timestamp without time zone")!;
31+
_timestampTzMapping = typeMappingSource.FindMapping(typeof(DateTime), "timestamp with time zone")!;
3232
_sqlExpressionFactory = sqlExpressionFactory;
3333
}
3434

src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlDateTimeMethodTranslator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ public NpgsqlDateTimeMethodTranslator(
113113
{
114114
_typeMappingSource = typeMappingSource;
115115
_sqlExpressionFactory = sqlExpressionFactory;
116-
_timestampMapping = typeMappingSource.FindMapping("timestamp without time zone")!;
117-
_timestampTzMapping = typeMappingSource.FindMapping("timestamp with time zone")!;
118-
_intervalMapping = typeMappingSource.FindMapping("interval")!;
116+
_timestampMapping = typeMappingSource.FindMapping(typeof(DateTime), "timestamp without time zone")!;
117+
_timestampTzMapping = typeMappingSource.FindMapping(typeof(DateTime), "timestamp with time zone")!;
118+
_intervalMapping = typeMappingSource.FindMapping(typeof(TimeSpan), "interval")!;
119119
_textMapping = typeMappingSource.FindMapping("text")!;
120120
}
121121

src/EFCore.PG/Storage/Internal/NpgsqlTypeMappingSource.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
using System.Text.Json;
1212
using Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure.Internal;
1313
using Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.Mapping;
14-
using Npgsql.Internal;
1514

1615
namespace Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal;
1716

0 commit comments

Comments
 (0)