@@ -671,7 +671,7 @@ Task Prepare(bool async, CancellationToken cancellationToken = default)
671671 {
672672 foreach ( var batchCommand in InternalBatchCommands )
673673 {
674- batchCommand . _parameters ? . ProcessParameters ( connector . SerializerOptions , validateValues : false , batchCommand . CommandType ) ;
674+ batchCommand . _parameters ? . ProcessParameters ( connector . ReloadableState , validateValues : false , batchCommand . CommandType ) ;
675675 ProcessRawQuery ( connector . SqlQueryParser , connector . UseConformingStrings , batchCommand ) ;
676676
677677 needToPrepare = batchCommand . ExplicitPrepare ( connector ) || needToPrepare ;
@@ -689,7 +689,7 @@ IEnumerable<string> CommandTexts()
689689 }
690690 else
691691 {
692- _parameters ? . ProcessParameters ( connector . SerializerOptions , validateValues : false , CommandType ) ;
692+ _parameters ? . ProcessParameters ( connector . ReloadableState , validateValues : false , CommandType ) ;
693693 ProcessRawQuery ( connector . SqlQueryParser , connector . UseConformingStrings , batchCommand : null ) ;
694694
695695 foreach ( var batchCommand in InternalBatchCommands )
@@ -1410,6 +1410,7 @@ internal virtual async ValueTask<NpgsqlDataReader> ExecuteReader(bool async, Com
14101410 if ( connector is not null )
14111411 {
14121412 var logger = connector. CommandLogger;
1413+ var reloadableState = connector . ReloadableState ;
14131414
14141415 cancellationToken . ThrowIfCancellationRequested ( ) ;
14151416 // We cannot pass a token here, as we'll cancel a non-send query
@@ -1440,7 +1441,7 @@ internal virtual async ValueTask<NpgsqlDataReader> ExecuteReader(bool async, Com
14401441 goto case false;
14411442 }
14421443
1443- batchCommand . _parameters ? . ProcessParameters ( connector . SerializerOptions , validateParameterValues , batchCommand . CommandType ) ;
1444+ batchCommand . _parameters ? . ProcessParameters ( reloadableState , validateParameterValues , batchCommand . CommandType ) ;
14441445 }
14451446 }
14461447 else
@@ -1453,7 +1454,7 @@ internal virtual async ValueTask<NpgsqlDataReader> ExecuteReader(bool async, Com
14531454 ResetPreparation ( ) ;
14541455 goto case false;
14551456 }
1456- _parameters ? . ProcessParameters ( connector . SerializerOptions , validateParameterValues , CommandType ) ;
1457+ _parameters ? . ProcessParameters ( reloadableState , validateParameterValues , CommandType ) ;
14571458 }
14581459
14591460 NpgsqlEventSource . Log . CommandStartPrepared ( ) ;
@@ -1469,7 +1470,7 @@ internal virtual async ValueTask<NpgsqlDataReader> ExecuteReader(bool async, Com
14691470 {
14701471 var batchCommand = InternalBatchCommands [ i ] ;
14711472
1472- batchCommand . _parameters ? . ProcessParameters ( connector . SerializerOptions , validateParameterValues , batchCommand . CommandType ) ;
1473+ batchCommand . _parameters ? . ProcessParameters ( reloadableState , validateParameterValues , batchCommand . CommandType ) ;
14731474 ProcessRawQuery ( connector . SqlQueryParser , connector . UseConformingStrings , batchCommand ) ;
14741475
14751476 if ( connector . Settings . MaxAutoPrepare > 0 && batchCommand . TryAutoPrepare ( connector ) )
@@ -1481,7 +1482,7 @@ internal virtual async ValueTask<NpgsqlDataReader> ExecuteReader(bool async, Com
14811482 }
14821483 else
14831484 {
1484- _parameters ? . ProcessParameters ( connector . SerializerOptions , validateParameterValues , CommandType ) ;
1485+ _parameters ? . ProcessParameters ( reloadableState , validateParameterValues , CommandType ) ;
14851486 ProcessRawQuery ( connector . SqlQueryParser , connector . UseConformingStrings , batchCommand : null ) ;
14861487
14871488 if ( connector . Settings . MaxAutoPrepare > 0 )
@@ -1565,6 +1566,7 @@ internal virtual async ValueTask<NpgsqlDataReader> ExecuteReader(bool async, Com
15651566
15661567 // The connection isn't bound to a connector - it's multiplexing time.
15671568 var dataSource = ( MultiplexingDataSource) conn. NpgsqlDataSource;
1569+ var reloadableState = dataSource. CurrentReloadableState;
15681570
15691571 if ( ! async)
15701572 {
@@ -1577,13 +1579,13 @@ internal virtual async ValueTask<NpgsqlDataReader> ExecuteReader(bool async, Com
15771579 {
15781580 foreach ( var batchCommand in InternalBatchCommands)
15791581 {
1580- batchCommand. _parameters? . ProcessParameters( dataSource . SerializerOptions , validateValues: true, batchCommand. CommandType) ;
1582+ batchCommand. _parameters? . ProcessParameters( reloadableState , validateValues: true, batchCommand. CommandType) ;
15811583 ProcessRawQuery( null , standardConformingStrings: true, batchCommand) ;
15821584 }
15831585 }
15841586 else
15851587 {
1586- _parameters? . ProcessParameters( dataSource . SerializerOptions , validateValues: true, CommandType) ;
1588+ _parameters? . ProcessParameters( reloadableState , validateValues: true, CommandType) ;
15871589 ProcessRawQuery( null , standardConformingStrings: true, batchCommand: null ) ;
15881590 }
15891591
0 commit comments