Skip to content

Commit c43f371

Browse files
committed
Move CreateConnectionPoolGroupProviderInfo
1 parent ca3e33d commit c43f371

File tree

2 files changed

+9
-24
lines changed

2 files changed

+9
-24
lines changed

src/Microsoft.Data.SqlClient/src/Microsoft/Data/ProviderBase/DbConnectionFactory.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ namespace Microsoft.Data.ProviderBase
1818
{
1919
internal abstract class DbConnectionFactory
2020
{
21-
internal abstract DbConnectionPoolGroupProviderInfo CreateConnectionPoolGroupProviderInfo(
22-
DbConnectionOptions connectionOptions);
23-
24-
internal abstract DbConnectionPoolProviderInfo CreateConnectionPoolProviderInfo(
25-
DbConnectionOptions connectionOptions);
26-
2721
protected virtual DbMetaDataFactory CreateMetaDataFactory(DbConnectionInternal internalConnection, out bool cacheMetaDataFactory)
2822
{
2923
// providers that support GetSchema must override this with a method that creates a meta data
@@ -46,7 +40,7 @@ protected DbConnectionOptions FindConnectionOptions(DbConnectionPoolKey key)
4640
}
4741
return null;
4842
}
49-
43+
5044
private static Task<DbConnectionInternal> GetCompletedTask()
5145
{
5246
Debug.Assert(Monitor.IsEntered(s_pendingOpenNonPooled), $"Expected {nameof(s_pendingOpenNonPooled)} lock to be held.");

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionFactory.cs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ internal void ClearPool(DbConnectionPoolKey key)
104104
}
105105
}
106106

107+
internal DbConnectionPoolProviderInfo CreateConnectionPoolProviderInfo(DbConnectionOptions connectionOptions) =>
108+
((SqlConnectionString)connectionOptions).UserInstance
109+
? new SqlConnectionPoolProviderInfo()
110+
: null;
111+
107112
internal SqlInternalConnectionTds CreateNonPooledConnection(
108113
DbConnection owningConnection,
109114
DbConnectionPoolGroup poolGroup,
@@ -164,18 +169,6 @@ protected override DbConnectionOptions CreateConnectionOptions(string connection
164169
return result;
165170
}
166171

167-
internal override DbConnectionPoolProviderInfo CreateConnectionPoolProviderInfo(DbConnectionOptions connectionOptions)
168-
{
169-
DbConnectionPoolProviderInfo providerInfo = null;
170-
171-
if (((SqlConnectionString)connectionOptions).UserInstance)
172-
{
173-
providerInfo = new SqlConnectionPoolProviderInfo();
174-
}
175-
176-
return providerInfo;
177-
}
178-
179172
protected override DbConnectionPoolGroupOptions CreateConnectionPoolGroupOptions(DbConnectionOptions connectionOptions)
180173
{
181174
SqlConnectionString opt = (SqlConnectionString)connectionOptions;
@@ -221,11 +214,9 @@ protected override DbConnectionPoolGroupOptions CreateConnectionPoolGroupOptions
221214
return poolingOptions;
222215
}
223216

224-
internal override DbConnectionPoolGroupProviderInfo CreateConnectionPoolGroupProviderInfo(
225-
DbConnectionOptions connectionOptions)
226-
{
227-
return new SqlConnectionPoolGroupProviderInfo((SqlConnectionString)connectionOptions);
228-
}
217+
internal DbConnectionPoolGroupProviderInfo CreateConnectionPoolGroupProviderInfo(
218+
DbConnectionOptions connectionOptions) =>
219+
new SqlConnectionPoolGroupProviderInfo((SqlConnectionString)connectionOptions);
229220

230221
internal SqlConnectionString FindSqlConnectionOptions(SqlConnectionPoolKey key)
231222
{

0 commit comments

Comments
 (0)