File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 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)
8888 for ( var i = 0 ; i < command . Parameters . Count ; i ++ )
8989 {
9090 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 )
9294 {
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 ;
95104 }
96105 }
97106 }
You can’t perform that action at this time.
0 commit comments