File tree Expand file tree Collapse file tree 2 files changed +36
-40
lines changed
src/Microsoft.Data.SqlClient/src/Microsoft/Data Expand file tree Collapse file tree 2 files changed +36
-40
lines changed Original file line number Diff line number Diff line change @@ -18,48 +18,11 @@ namespace Microsoft.Data.ProviderBase
18
18
{
19
19
internal abstract class DbConnectionFactory
20
20
{
21
- public void ClearAllPools ( )
22
- {
23
- using ( TryEventScope . Create ( nameof ( SqlConnectionFactory ) ) )
24
- {
25
- Dictionary < DbConnectionPoolKey , DbConnectionPoolGroup > connectionPoolGroups = _connectionPoolGroups ;
26
- foreach ( KeyValuePair < DbConnectionPoolKey , DbConnectionPoolGroup > entry in connectionPoolGroups )
27
- {
28
- DbConnectionPoolGroup poolGroup = entry . Value ;
29
- if ( poolGroup != null )
30
- {
31
- poolGroup . Clear ( ) ;
32
- }
33
- }
34
- }
35
- }
21
+
36
22
37
- public void ClearPool ( DbConnection connection )
38
- {
39
- ADP . CheckArgumentNull ( connection , nameof ( connection ) ) ;
40
- using ( TryEventScope . Create ( "<prov.DbConnectionFactory.ClearPool|API> {0}" , GetObjectId ( connection ) ) )
41
- {
42
- DbConnectionPoolGroup poolGroup = GetConnectionPoolGroup ( connection ) ;
43
- if ( poolGroup != null )
44
- {
45
- poolGroup . Clear ( ) ;
46
- }
47
- }
48
- }
23
+
49
24
50
- public void ClearPool ( DbConnectionPoolKey key )
51
- {
52
- Debug . Assert ( key != null , "key cannot be null" ) ;
53
- ADP . CheckArgumentNull ( key . ConnectionString , $ "{ nameof ( key ) } .{ nameof ( key . ConnectionString ) } ") ;
54
- using ( TryEventScope . Create ( "<prov.DbConnectionFactory.ClearPool|API> connectionString" ) )
55
- {
56
- Dictionary < DbConnectionPoolKey , DbConnectionPoolGroup > connectionPoolGroups = _connectionPoolGroups ;
57
- if ( connectionPoolGroups . TryGetValue ( key , out DbConnectionPoolGroup poolGroup ) )
58
- {
59
- poolGroup . Clear ( ) ;
60
- }
61
- }
62
- }
25
+
63
26
64
27
internal abstract DbConnectionPoolProviderInfo CreateConnectionPoolProviderInfo (
65
28
DbConnectionOptions connectionOptions ) ;
Original file line number Diff line number Diff line change @@ -73,6 +73,39 @@ private SqlConnectionFactory()
73
73
74
74
#endregion
75
75
76
+ #region Public Methods
77
+
78
+ internal void ClearAllPools ( )
79
+ {
80
+ using TryEventScope scope = TryEventScope . Create ( nameof ( SqlConnectionFactory ) ) ;
81
+ foreach ( ( DbConnectionPoolKey _ , DbConnectionPoolGroup group ) in _connectionPoolGroups )
82
+ {
83
+ group ? . Clear ( ) ;
84
+ }
85
+ }
86
+
87
+ internal void ClearPool ( DbConnection connection )
88
+ {
89
+ ADP . CheckArgumentNull ( connection , nameof ( connection ) ) ;
90
+
91
+ using TryEventScope scope = TryEventScope . Create ( "<prov.SqlConnectionFactory.ClearPool|API> {0}" , GetObjectId ( connection ) ) ;
92
+ DbConnectionPoolGroup poolGroup = GetConnectionPoolGroup ( connection ) ;
93
+ poolGroup ? . Clear ( ) ;
94
+ }
95
+
96
+ internal void ClearPool ( DbConnectionPoolKey key )
97
+ {
98
+ ADP . CheckArgumentNull ( key . ConnectionString , $ "{ nameof ( key ) } .{ nameof ( key . ConnectionString ) } ") ;
99
+
100
+ using TryEventScope scope = TryEventScope . Create ( "<prov.SqlConnectionFactory.ClearPool|API> connectionString" ) ;
101
+ if ( _connectionPoolGroups . TryGetValue ( key , out DbConnectionPoolGroup poolGroup ) )
102
+ {
103
+ poolGroup ? . Clear ( ) ;
104
+ }
105
+ }
106
+
107
+ #endregion
108
+
76
109
protected override DbConnectionInternal CreateConnection (
77
110
DbConnectionOptions options ,
78
111
DbConnectionPoolKey poolKey ,
You can’t perform that action at this time.
0 commit comments