@@ -263,6 +263,24 @@ internal int RecordsAffected
263263 }
264264 }
265265
266+ /// <summary>
267+ /// The rows an INSERT, UPDATE or DELETE affected, or -1 for any other statement (DbCommand.ExecuteNonQuery: "For all
268+ /// other types of statements, the return value is -1"; DbDataReader.RecordsAffected: "-1 for SELECT statements").
269+ /// </summary>
270+ internal int StatementRecordsAffected
271+ {
272+ get
273+ {
274+ return _statement ? . StatementType switch
275+ {
276+ DbStatementType . Insert => RecordsAffected ,
277+ DbStatementType . Update => RecordsAffected ,
278+ DbStatementType . Delete => RecordsAffected ,
279+ _ => - 1 ,
280+ } ;
281+ }
282+ }
283+
266284 internal bool IsDisposed
267285 {
268286 get { return _disposed ; }
@@ -529,13 +547,7 @@ public override int ExecuteNonQuery()
529547 }
530548 }
531549
532- return _statement . StatementType switch
533- {
534- DbStatementType . Insert => RecordsAffected ,
535- DbStatementType . Update => RecordsAffected ,
536- DbStatementType . Delete => RecordsAffected ,
537- _ => - 1 ,
538- } ;
550+ return StatementRecordsAffected ;
539551 }
540552 public override async Task < int > ExecuteNonQueryAsync ( CancellationToken cancellationToken )
541553 {
@@ -566,13 +578,7 @@ public override async Task<int> ExecuteNonQueryAsync(CancellationToken cancellat
566578 }
567579 }
568580
569- return _statement . StatementType switch
570- {
571- DbStatementType . Insert => RecordsAffected ,
572- DbStatementType . Update => RecordsAffected ,
573- DbStatementType . Delete => RecordsAffected ,
574- _ => - 1 ,
575- } ;
581+ return StatementRecordsAffected ;
576582 }
577583
578584 public new FbDataReader ExecuteReader ( ) => ExecuteReader ( CommandBehavior . Default ) ;
0 commit comments