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
13
13
public readonly OrmLiteConnectionFactory Factory ;
14
14
public IDbTransaction Transaction { get ; set ; }
15
15
private IDbConnection dbConnection ;
16
- private bool isOpen ;
17
16
18
17
public OrmLiteConnection ( OrmLiteConnectionFactory factory )
19
18
{
@@ -39,7 +38,6 @@ public void Dispose()
39
38
40
39
DbConnection . Dispose ( ) ;
41
40
dbConnection = null ;
42
- isOpen = false ;
43
41
}
44
42
45
43
public IDbTransaction BeginTransaction ( )
@@ -62,7 +60,6 @@ public IDbTransaction BeginTransaction(IsolationLevel isolationLevel)
62
60
63
61
public void Close ( )
64
62
{
65
- isOpen = false ;
66
63
DbConnection . Close ( ) ;
67
64
}
68
65
@@ -84,13 +81,15 @@ public IDbCommand CreateCommand()
84
81
85
82
public void Open ( )
86
83
{
87
- if ( isOpen )
88
- return ;
84
+ if ( DbConnection . State == ConnectionState . Broken )
85
+ DbConnection . Close ( ) ;
89
86
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
+ }
94
93
}
95
94
96
95
public string ConnectionString
You can’t perform that action at this time.
0 commit comments