@@ -504,7 +504,7 @@ internal async Task Open(NpgsqlTimeout timeout, bool async, CancellationToken ca
504504 SerializerOptions = DataSource . SerializerOptions ;
505505 DatabaseInfo = DataSource . DatabaseInfo ;
506506
507- if ( Settings . Pooling && ! Settings . Multiplexing && ! Settings . NoResetOnClose && DatabaseInfo . SupportsDiscard )
507+ if ( Settings . Pooling && Settings is { Multiplexing : false , NoResetOnClose : false } && DatabaseInfo . SupportsDiscard )
508508 {
509509 _sendResetOnClose = true ;
510510 GenerateResetMessage ( ) ;
@@ -1145,7 +1145,7 @@ void SetSocketOptions(Socket socket)
11451145
11461146 if ( Settings . TcpKeepAlive )
11471147 socket. SetSocketOption ( SocketOptionLevel . Socket , SocketOptionName . KeepAlive , true ) ;
1148- if ( Settings . TcpKeepAliveInterval > 0 && Settings . TcpKeepAliveTime == 0 )
1148+ if ( Settings is { TcpKeepAliveInterval : > 0 , TcpKeepAliveTime : 0 } )
11491149 throw new ArgumentException ( "If TcpKeepAliveInterval is defined, TcpKeepAliveTime must be defined as well" ) ;
11501150 if ( Settings . TcpKeepAliveTime > 0 )
11511151 {
@@ -2001,7 +2001,7 @@ internal async Task CloseOngoingOperations(bool async)
20012001 // therefore vulnerable to the race condition in #615.
20022002 if ( copyOperation is NpgsqlBinaryImporter ||
20032003 copyOperation is NpgsqlCopyTextWriter ||
2004- copyOperation is NpgsqlRawCopyStream rawCopyStream && rawCopyStream . CanWrite )
2004+ copyOperation is NpgsqlRawCopyStream { CanWrite: true } )
20052005 {
20062006 try
20072007 {
@@ -2676,7 +2676,7 @@ internal async Task<bool> Wait(bool async, int timeout, CancellationToken cancel
26762676 {
26772677 msg = await ReadMessageWithNotifications ( async ) . ConfigureAwait( false) ;
26782678 }
2679- catch ( Exception e) when ( e is OperationCanceledException || e is NpgsqlException npgEx && npgEx . InnerException is TimeoutException)
2679+ catch ( Exception e) when ( e is OperationCanceledException || e is NpgsqlException { InnerException: TimeoutException } )
26802680 {
26812681 // We're somewhere in the middle of a reading keepalive messages
26822682 // Breaking the connection, as we've lost protocol sync
0 commit comments