File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,13 @@ public override void Close()
9595 throw new InvalidOperationException ( "Connection is already closed." ) ;
9696 }
9797
98- Dispose ( true ) ;
98+ if ( connectionReference is not null ) //Should always be the case
99+ {
100+ connectionManager . ReturnConnectionReference ( connectionReference ) ;
101+ }
102+
103+ connectionState = ConnectionState . Closed ;
104+ OnStateChange ( FromOpenToClosedEventArgs ) ;
99105 }
100106
101107 public override void Open ( )
@@ -182,15 +188,10 @@ protected override void Dispose(bool disposing)
182188 {
183189 if ( disposing )
184190 {
191+ // this check is to ensure exact same behavior as previous version
192+ // where Close() was calling Dispose(true) instead of the other way around.
185193 if ( connectionState == ConnectionState . Open )
186- {
187- if ( connectionReference is not null ) //Should always be the case
188- {
189- connectionManager . ReturnConnectionReference ( connectionReference ) ;
190- }
191- connectionState = ConnectionState . Closed ;
192- OnStateChange ( FromOpenToClosedEventArgs ) ;
193- }
194+ Close ( ) ;
194195 }
195196
196197 base . Dispose ( disposing ) ;
You can’t perform that action at this time.
0 commit comments