File tree 1 file changed +12
-3
lines changed
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -88,10 +88,19 @@ public override void AdjustCommand(DbCommand command)
88
88
for ( var i = 0 ; i < command . Parameters . Count ; i ++ )
89
89
{
90
90
var parameter = command . Parameters [ i ] ;
91
- if ( parameter . Value is DateTime )
91
+ if ( parameter . DbType == DbType . DateTime &&
92
+ parameter . Value is DateTime dateTime &&
93
+ dateTime . Kind != DateTimeKind . Utc )
92
94
{
93
- // Let Npgsql 6 driver to decide parameter type
94
- parameter . ResetDbType ( ) ;
95
+ // There are breaking changes in Npgsql 6 as following:
96
+ // UTC DateTime is now strictly mapped to timestamptz,
97
+ // while Local/Unspecified DateTime is now strictly mapped to timestamp.
98
+ //
99
+ // DbType.DateTime now maps to timestamptz, not timestamp.
100
+ // DbType.DateTime2 continues to map to timestamp
101
+ //
102
+ // See more details here: https://www.npgsql.org/doc/release-notes/6.0.html#detailed-notes
103
+ parameter . DbType = DbType . DateTime2 ;
95
104
}
96
105
}
97
106
}
You can’t perform that action at this time.
0 commit comments