File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,22 @@ public sealed class YdbTransaction : DbTransaction
99{
1010 private readonly TxMode _txMode ;
1111
12+ private bool _failed ;
13+
1214 internal string ? TxId { get ; set ; }
13- internal bool Completed { get ; set ; }
14- internal bool Failed { get ; set ; }
15+ internal bool Completed { get ; private set ; }
16+
17+ internal bool Failed
18+ {
19+ private get => _failed ;
20+ set
21+ {
22+ _failed = value ;
23+ Completed = true ;
24+ }
25+ }
1526
16- internal TransactionControl ? TransactionControl => Completed || Failed
27+ internal TransactionControl ? TransactionControl => Completed
1728 ? null
1829 : TxId == null
1930 ? new TransactionControl { BeginTx = _txMode . TransactionSettings ( ) }
@@ -47,7 +58,6 @@ public override void Rollback()
4758 if ( Failed )
4859 {
4960 Failed = false ;
50- Completed = true ; // make completed
5161
5262 return ;
5363 }
@@ -63,7 +73,7 @@ public override void Rollback()
6373
6474 private async Task FinishTransaction ( Func < string , Task < Status > > finishMethod )
6575 {
66- if ( Failed || Completed || DbConnection . State == ConnectionState . Closed )
76+ if ( Completed || DbConnection . State == ConnectionState . Closed )
6777 {
6878 throw new InvalidOperationException ( "This YdbTransaction has completed; it is no longer usable" ) ;
6979 }
You can’t perform that action at this time.
0 commit comments