@@ -633,15 +633,7 @@ Task Prepare(bool async, CancellationToken cancellationToken = default)
633633 {
634634 foreach ( var batchCommand in InternalBatchCommands )
635635 {
636- batchCommand . Parameters . HasOutputParameters = false ;
637- batchCommand . Parameters . PlaceholderType = PlaceholderType . NoParameters ;
638-
639- foreach ( var p in batchCommand . Parameters . InternalList )
640- {
641- batchCommand . Parameters . CalculatePlaceholderType ( p ) ;
642- p . Bind ( connector . TypeMapper ) ;
643- }
644-
636+ batchCommand . Parameters . ProcessParameters ( connector . TypeMapper , validate : false ) ;
645637 ProcessRawQuery ( connector . SqlQueryParser , connector . UseConformingStrings , batchCommand ) ;
646638
647639 needToPrepare = batchCommand . ExplicitPrepare ( connector ) || needToPrepare ;
@@ -652,15 +644,7 @@ Task Prepare(bool async, CancellationToken cancellationToken = default)
652644 }
653645 else
654646 {
655- Parameters . HasOutputParameters = false ;
656- Parameters . PlaceholderType = PlaceholderType . NoParameters ;
657-
658- foreach ( var p in Parameters . InternalList )
659- {
660- Parameters . CalculatePlaceholderType ( p ) ;
661- p . Bind ( connector . TypeMapper ) ;
662- }
663-
647+ Parameters . ProcessParameters ( connector . TypeMapper , validate : false ) ;
664648 ProcessRawQuery ( connector . SqlQueryParser , connector . UseConformingStrings , batchCommand : null ) ;
665649
666650 foreach ( var batchCommand in InternalBatchCommands )
@@ -1335,9 +1319,9 @@ internal async ValueTask<NpgsqlDataReader> ExecuteReader(CommandBehavior behavio
13351319
13361320 if ( IsWrappedByBatch)
13371321 foreach ( var batchCommand in InternalBatchCommands)
1338- batchCommand. Parameters. ValidateAndBind ( connector. TypeMapper) ;
1322+ batchCommand. Parameters. ProcessParameters ( connector. TypeMapper, validate : true ) ;
13391323 else
1340- Parameters. ValidateAndBind ( connector. TypeMapper) ;
1324+ Parameters. ProcessParameters ( connector. TypeMapper, validate : true ) ;
13411325
13421326 NpgsqlEventSource. Log. CommandStartPrepared( ) ;
13431327 break ;
@@ -1351,7 +1335,7 @@ internal async ValueTask<NpgsqlDataReader> ExecuteReader(CommandBehavior behavio
13511335 {
13521336 var batchCommand = InternalBatchCommands[ i] ;
13531337
1354- batchCommand. Parameters. ValidateAndBind ( connector. TypeMapper) ;
1338+ batchCommand. Parameters. ProcessParameters ( connector. TypeMapper, validate : true ) ;
13551339 ProcessRawQuery( connector. SqlQueryParser, connector. UseConformingStrings, batchCommand) ;
13561340
13571341 if ( connector. Settings. MaxAutoPrepare > 0 && batchCommand. TryAutoPrepare( connector) )
@@ -1360,7 +1344,7 @@ internal async ValueTask<NpgsqlDataReader> ExecuteReader(CommandBehavior behavio
13601344 }
13611345 else
13621346 {
1363- Parameters. ValidateAndBind ( connector. TypeMapper) ;
1347+ Parameters. ProcessParameters ( connector. TypeMapper, validate : true ) ;
13641348 ProcessRawQuery( connector. SqlQueryParser, connector. UseConformingStrings, batchCommand: null ) ;
13651349
13661350 if ( connector. Settings. MaxAutoPrepare > 0 )
@@ -1452,13 +1436,13 @@ internal async ValueTask<NpgsqlDataReader> ExecuteReader(CommandBehavior behavio
14521436 {
14531437 foreach ( var batchCommand in InternalBatchCommands)
14541438 {
1455- batchCommand. Parameters. ValidateAndBind ( pool. MultiplexingTypeMapper! ) ;
1439+ batchCommand. Parameters. ProcessParameters ( pool. MultiplexingTypeMapper! , validate : true ) ;
14561440 ProcessRawQuery( null , standardConformingStrings: true, batchCommand) ;
14571441 }
14581442 }
14591443 else
14601444 {
1461- Parameters. ValidateAndBind ( pool. MultiplexingTypeMapper! ) ;
1445+ Parameters. ProcessParameters ( pool. MultiplexingTypeMapper! , validate : true ) ;
14621446 ProcessRawQuery( null , standardConformingStrings: true, batchCommand: null ) ;
14631447 }
14641448
0 commit comments