Skip to content

Commit aec0d1f

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 aec0d1f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
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

0 commit comments

Comments
 (0)