This repository was archived by the owner on Dec 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ public class OrmLiteConnection
1313 public readonly OrmLiteConnectionFactory Factory ;
1414 public IDbTransaction Transaction { get ; set ; }
1515 private IDbConnection dbConnection ;
16- private bool isOpen ;
1716
1817 public OrmLiteConnection ( OrmLiteConnectionFactory factory )
1918 {
@@ -39,7 +38,6 @@ public void Dispose()
3938
4039 DbConnection . Dispose ( ) ;
4140 dbConnection = null ;
42- isOpen = false ;
4341 }
4442
4543 public IDbTransaction BeginTransaction ( )
@@ -62,7 +60,6 @@ public IDbTransaction BeginTransaction(IsolationLevel isolationLevel)
6260
6361 public void Close ( )
6462 {
65- isOpen = false ;
6663 DbConnection . Close ( ) ;
6764 }
6865
@@ -84,13 +81,15 @@ public IDbCommand CreateCommand()
8481
8582 public void Open ( )
8683 {
87- if ( isOpen )
88- return ;
84+ if ( DbConnection . State == ConnectionState . Broken )
85+ DbConnection . Close ( ) ;
8986
90- DbConnection . Open ( ) ;
91- //so the internal connection is wrapped for example by miniprofiler
92- if ( Factory . ConnectionFilter != null ) { dbConnection = Factory . ConnectionFilter ( dbConnection ) ; }
93- isOpen = true ;
87+ if ( DbConnection . State == ConnectionState . Closed )
88+ {
89+ DbConnection . Open ( ) ;
90+ //so the internal connection is wrapped for example by miniprofiler
91+ if ( Factory . ConnectionFilter != null ) { dbConnection = Factory . ConnectionFilter ( dbConnection ) ; }
92+ }
9493 }
9594
9695 public string ConnectionString
You can’t perform that action at this time.
0 commit comments