File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,11 @@ public sealed class YdbTransaction : DbTransaction
1313 internal bool Completed { get ; set ; }
1414 internal bool Failed { get ; set ; }
1515
16- internal TransactionControl TransactionControl => TxId == null
17- ? new TransactionControl { BeginTx = _txMode . TransactionSettings ( ) }
18- : new TransactionControl { TxId = TxId } ;
16+ internal TransactionControl ? TransactionControl => Completed || Failed
17+ ? null
18+ : TxId == null
19+ ? new TransactionControl { BeginTx = _txMode . TransactionSettings ( ) }
20+ : new TransactionControl { TxId = TxId } ;
1921
2022 internal YdbTransaction ( YdbConnection ydbConnection , TxMode txMode )
2123 {
Original file line number Diff line number Diff line change @@ -57,7 +57,8 @@ public async Task IsTransient_WhenAborted_ReturnTrueAndMakeEmptyRollback()
5757 {
5858 CommandText = $ "DROP TABLE { bankTable } "
5959 } . ExecuteNonQueryAsync ( ) ;
60- Assert . Equal ( "Status: NotFound" , Assert . Throws < YdbException > ( ( ) => ydbCommand . Transaction . Commit ( ) ) . Message ) ;
60+ Assert . Equal ( "This YdbTransaction has completed; it is no longer usable" ,
61+ Assert . Throws < InvalidOperationException > ( ( ) => ydbCommand . Transaction . Commit ( ) ) . Message ) ;
6162
6263 await ydbCommand . Transaction ! . RollbackAsync ( ) ;
6364 Assert . Equal ( "This YdbTransaction has completed; it is no longer usable" ,
You can’t perform that action at this time.
0 commit comments