|
3 | 3 | using System.Data;
|
4 | 4 | using System.Data.Common;
|
5 | 5 | using System.Linq;
|
6 |
| -using System.Reflection; |
7 | 6 | using System.Text.RegularExpressions;
|
| 7 | +using FirebirdSql.Data.FirebirdClient; |
8 | 8 | using NHibernate.Dialect;
|
9 | 9 | using NHibernate.SqlCommand;
|
10 | 10 | using NHibernate.SqlTypes;
|
@@ -40,12 +40,12 @@ public override string NamedPrefix
|
40 | 40 |
|
41 | 41 | public override DbConnection CreateConnection()
|
42 | 42 | {
|
43 |
| - return new FirebirdSql.Data.FirebirdClient.FbConnection(); |
| 43 | + return new FbConnection(); |
44 | 44 | }
|
45 | 45 |
|
46 | 46 | public override DbCommand CreateCommand()
|
47 | 47 | {
|
48 |
| - return new FirebirdSql.Data.FirebirdClient.FbCommand(); |
| 48 | + return new FbCommand(); |
49 | 49 | }
|
50 | 50 |
|
51 | 51 |
|
@@ -105,39 +105,24 @@ private string GetFbTypeFromDbType(DbType dbType)
|
105 | 105 | return _fbDialect.GetCastTypeName(new SqlType(dbType));
|
106 | 106 | }
|
107 | 107 |
|
108 |
| - private static volatile MethodInfo _clearPool; |
109 |
| - private static volatile MethodInfo _clearAllPools; |
110 |
| - |
111 | 108 | /// <summary>
|
112 | 109 | /// Clears the connection pool.
|
113 | 110 | /// </summary>
|
114 | 111 | /// <param name="connectionString">The connection string of connections for which to clear the pool.
|
115 | 112 | /// <c>null</c> for clearing them all.</param>
|
116 | 113 | public void ClearPool(string connectionString)
|
117 | 114 | {
|
118 |
| - // In case of concurrent threads, may initialize many times. We do not care. |
119 |
| - // Members are volatile for avoiding it gets used while its constructor is not yet ended. |
120 |
| - if (_clearPool == null || _clearAllPools == null) |
121 |
| - { |
122 |
| - using (var clearConnection = CreateConnection()) |
123 |
| - { |
124 |
| - var connectionType = clearConnection.GetType(); |
125 |
| - _clearPool = connectionType.GetMethod("ClearPool") ?? throw new InvalidOperationException("Unable to resolve ClearPool method."); |
126 |
| - _clearAllPools = connectionType.GetMethod("ClearAllPools") ?? throw new InvalidOperationException("Unable to resolve ClearAllPools method."); |
127 |
| - } |
128 |
| - } |
129 |
| - |
130 | 115 | if (connectionString != null)
|
131 | 116 | {
|
132 | 117 | using (var clearConnection = CreateConnection())
|
133 | 118 | {
|
134 | 119 | clearConnection.ConnectionString = connectionString;
|
135 |
| - _clearPool.Invoke(null, new object[] {clearConnection}); |
| 120 | + FbConnection.ClearPool((FbConnection)clearConnection); |
136 | 121 | }
|
137 | 122 | return;
|
138 | 123 | }
|
139 | 124 |
|
140 |
| - _clearAllPools.Invoke(null, new object[0]); |
| 125 | + FbConnection.ClearAllPools(); |
141 | 126 | }
|
142 | 127 | }
|
143 | 128 | }
|
0 commit comments