@@ -52,13 +52,13 @@ public override void Commit()
5252 {
5353 EnsureIsNotDisposed ( ) ;
5454 EnsureTransactionIsActive ( ) ;
55-
5655 try {
57- if ( ! IsTransactionCompleted ( ) )
58- ActiveTransaction . Commit ( ) ;
56+ if ( ! IsTransactionCompleted ( ) ) {
57+ activeTransaction . Commit ( ) ;
58+ }
5959 }
6060 finally {
61- ActiveTransaction . Dispose ( ) ;
61+ activeTransaction . Dispose ( ) ;
6262 ClearActiveTransaction ( ) ;
6363 }
6464 }
@@ -68,11 +68,12 @@ public override async Task CommitAsync(CancellationToken token = default)
6868 EnsureIsNotDisposed ( ) ;
6969 EnsureTransactionIsActive ( ) ;
7070 try {
71- if ( ! IsTransactionCompleted ( ) )
72- await ActiveTransaction . CommitAsync ( token ) . ConfigureAwait ( false ) ;
71+ if ( ! IsTransactionCompleted ( ) ) {
72+ await activeTransaction . CommitAsync ( token ) . ConfigureAwait ( false ) ;
73+ }
7374 }
7475 finally {
75- await ActiveTransaction . DisposeAsync ( ) . ConfigureAwait ( false ) ;
76+ await activeTransaction . DisposeAsync ( ) . ConfigureAwait ( false ) ;
7677 ClearActiveTransaction ( ) ;
7778 }
7879 }
@@ -81,13 +82,13 @@ public override void Rollback()
8182 {
8283 EnsureIsNotDisposed ( ) ;
8384 EnsureTransactionIsActive ( ) ;
84-
8585 try {
86- if ( ! IsTransactionCompleted ( ) )
87- ActiveTransaction . Rollback ( ) ;
86+ if ( ! IsTransactionCompleted ( ) ) {
87+ activeTransaction . Rollback ( ) ;
88+ }
8889 }
8990 finally {
90- ActiveTransaction . Dispose ( ) ;
91+ activeTransaction . Dispose ( ) ;
9192 ClearActiveTransaction ( ) ;
9293 }
9394 }
@@ -97,11 +98,12 @@ public override async Task RollbackAsync(CancellationToken token = default)
9798 EnsureIsNotDisposed ( ) ;
9899 EnsureTransactionIsActive ( ) ;
99100 try {
100- if ( ! IsTransactionCompleted ( ) )
101- await ActiveTransaction . RollbackAsync ( token ) . ConfigureAwait ( false ) ;
101+ if ( ! IsTransactionCompleted ( ) ) {
102+ await activeTransaction . RollbackAsync ( token ) . ConfigureAwait ( false ) ;
103+ }
102104 }
103105 finally {
104- await ActiveTransaction . DisposeAsync ( ) . ConfigureAwait ( false ) ;
106+ await activeTransaction . DisposeAsync ( ) . ConfigureAwait ( false ) ;
105107 ClearActiveTransaction ( ) ;
106108 }
107109 }
@@ -167,7 +169,7 @@ private void ExecuteNonQuery(string commandText)
167169 EnsureTransactionIsActive ( ) ;
168170
169171 using var command = CreateCommand ( commandText ) ;
170- command . ExecuteNonQuery ( ) ;
172+ _ = command . ExecuteNonQuery ( ) ;
171173 }
172174
173175 private async Task ExecuteNonQueryAsync ( string commandText , CancellationToken token )
@@ -177,14 +179,11 @@ private async Task ExecuteNonQueryAsync(string commandText, CancellationToken to
177179
178180 var command = CreateCommand ( commandText ) ;
179181 await using ( command . ConfigureAwait ( false ) ) {
180- await command . ExecuteNonQueryAsync ( token ) . ConfigureAwait ( false ) ;
182+ _ = await command . ExecuteNonQueryAsync ( token ) . ConfigureAwait ( false ) ;
181183 }
182184 }
183185
184- private bool IsTransactionCompleted ( )
185- {
186- return activeTransaction != null && activeTransaction . Connection == null ;
187- }
186+ private bool IsTransactionCompleted ( ) => activeTransaction . Connection == null ;
188187
189188 // Constructors
190189
0 commit comments