Skip to content

Commit c678bc6

Browse files
committed
Merge remote-tracking branch 'origin/main' into public
2 parents e894bb1 + aaba34f commit c678bc6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1293
-2176
lines changed

doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ Next, compile and execute the following:
150150
</remarks>
151151
<example>
152152
<para>
153-
The following example creates a <see cref="T:Microsoft.Data.SqlClient.SqlCommand" />, passing in the connection string and command text.
153+
The following example creates a <see cref="T:Microsoft.Data.SqlClient.SqlCommand" />, passing in the command text.
154154
</para>
155155
<!-- SqlCommand_SqlCommand1 -->
156156
<code language="c#">

doc/snippets/Microsoft.Data.SqlClient/SqlConnectionStringBuilder.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ The following example supplies a simple SQL Server connection string in the <xre
361361
This property corresponds to the "Connect Retry Count" key within the <xref:Microsoft.Data.SqlClient.SqlConnection> connection string.
362362
363363
> [!NOTE]
364-
> Since version 5.x the default value for none Azure endpoints is 1 and for Azure SQL and Azure Synapse has increased to 2 and 5 to imporve the recovery against on high demand Azure endpoints. It should be detected first, and Synapse could be detected as a regular Azure SQL DB endpoint.
364+
> Since version 5.x the default value for none Azure endpoints is 1 and for Azure SQL and Azure Synapse has increased to 2 and 5 to improve the recovery against on high demand Azure endpoints. It should be detected first, and Synapse could be detected as a regular Azure SQL DB endpoint.
365365
366366
]]>
367367
</format>
@@ -539,7 +539,7 @@ This property corresponds to the "Connect Retry Count" key within the <xref:Micr
539539
</value>
540540
<remarks>
541541
<para>
542-
This property corresponds to the "Data Source", "server", "address", "addr", and "network address" keys within the connection string. Regardless of which of these values has been supplied within the supplied connection string, the connection string created by the <c>SqlConnectionStringBuilder</c> will use the well-known "Data Source" key. The port number can be specified after the server name: <c>server=tcp:servername,portnumber</c> .
542+
This property corresponds to the "Data Source", "server", "address", "addr", and "network address" keys within the connection string. Regardless of which of these values has been supplied within the supplied connection string, the connection string created by the <c>SqlConnectionStringBuilder</c> will use the well-known "Data Source" key. The port number can be specified after the server name: <c>server=tcp:servername,port</c> .
543543
</para>
544544
<para>
545545
When specifying a local instance, always use (local). To force a protocol, add one of the following prefixes: <c>np:(local), tcp:(local), lpc:(local)</c> .
@@ -664,7 +664,7 @@ When `TrustServerCertificate` is false and `Encrypt` is <xref:Microsoft.Data.Sql
664664
</Encrypt>
665665
<Enlist>
666666
<summary>
667-
Gets or sets a Boolean value that indicates whether the SQL Server connection pooler automatically enlists the connection in the creation thread's current transaction context.
667+
Gets or sets a Boolean value that indicates whether the SQL Server connection pool automatically enlists the connection in the creation thread's current transaction context.
668668
</summary>
669669
<value>
670670
The value of the <see cref="P:Microsoft.Data.SqlClient.SqlConnectionStringBuilder.Enlist" /> property, or <see langword="true" /> if none has been supplied.
@@ -727,7 +727,7 @@ This property corresponds to the "FailoverPartnerSPN" and "Failover Partner SPN"
727727
<remarks>
728728
<format type="text/markdown">
729729
<![CDATA[
730-
This property corresponds to the "HostNameInCertificiate" and "Host Name in Certificiate" keys within the connection string.
730+
This property corresponds to the "HostNameInCertificate" and "Host Name in Certificate" keys within the connection string.
731731
732732
> [!NOTE]
733733
> This property only applies when using `Encrypt` in <xref:Microsoft.Data.SqlClient.SqlConnectionEncryptOption.Mandatory%2A> or <xref:Microsoft.Data.SqlClient.SqlConnectionEncryptOption.Strict%2A> mode, otherwise it is ignored.

src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Constants.cs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,24 @@ internal static class Constants
99
/// <summary>
1010
/// Azure Key Vault Domain Name
1111
/// </summary>
12-
internal static readonly string[] AzureKeyVaultPublicDomainNames = new string[] {
13-
@"vault.azure.net", // default
14-
@"vault.azure.cn", // Azure China
15-
@"vault.usgovcloudapi.net", // US Government
16-
@"vault.microsoftazure.de", // Azure Germany
17-
@"managedhsm.azure.net", // public HSM vault
18-
@"managedhsm.azure.cn", // Azure China HSM vault
19-
@"managedhsm.usgovcloudapi.net", // US Government HSM vault
20-
@"managedhsm.microsoftazure.de" // Azure Germany HSM vault
21-
};
12+
internal static readonly string[] AzureKeyVaultPublicDomainNames =
13+
[
14+
// Azure Key Vaults
15+
"vault.azure.net", // Default
16+
"vault.azure.cn", // China
17+
"vault.usgovcloudapi.net", // US Government
18+
"vault.microsoftazure.de", // Azure Germany
19+
"vault.sovcloud-api.fr", // France (Bleu)
20+
"vault.sovcloud-api.de", // Germany (Delos)
21+
22+
// Managed High Security Modules (HSM) Vaults
23+
"managedhsm.azure.net",
24+
"managedhsm.azure.cn",
25+
"managedhsm.usgovcloudapi.net",
26+
"managedhsm.microsoftazure.de",
27+
"managedhsm.sovcloud-api.fr",
28+
"managedhsm.sovcloud-api.de"
29+
];
2230

2331
/// <summary>
2432
/// Always Encrypted Parameter names for exec handling

src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Utils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ internal static ArgumentException InvalidAKVPath(string masterKeyPath, bool isSy
141141
internal static ArgumentException InvalidAKVUrl(string masterKeyPath) =>
142142
new(string.Format(CultureInfo.InvariantCulture, Strings.InvalidAkvUrlTemplate, masterKeyPath), Constants.AeParamMasterKeyPath);
143143

144-
internal static Exception InvalidAKVUrlTrustedEndpoints(string masterKeyPath, string endpoints) =>
144+
internal static ArgumentException InvalidAKVUrlTrustedEndpoints(string masterKeyPath, string endpoints) =>
145145
new ArgumentException(string.Format(CultureInfo.InvariantCulture, Strings.InvalidAkvKeyPathTrustedTemplate, masterKeyPath, endpoints),
146146
Constants.AeParamMasterKeyPath);
147147
}

src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,6 @@
9999
<Compile Include="$(CommonSourceRoot)\Microsoft\Data\ProviderBase\DbConnectionClosed.cs">
100100
<Link>Microsoft\Data\ProviderBase\DbConnectionClosed.cs</Link>
101101
</Compile>
102-
<Compile Include="$(CommonSourceRoot)\Microsoft\Data\ProviderBase\DbConnectionFactory.cs">
103-
<Link>Microsoft\Data\ProviderBase\DbConnectionFactory.cs</Link>
104-
</Compile>
105102
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ConnectionPool\ChannelDbConnectionPool.cs">
106103
<Link>Microsoft\Data\SqlClient\ConnectionPool\ChannelDbConnectionPool.cs</Link>
107104
</Compile>

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,7 +1286,7 @@ public override void ChangeDatabase(string database)
12861286
/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlConnection.xml' path='docs/members[@name="SqlConnection"]/ClearAllPools/*' />
12871287
public static void ClearAllPools()
12881288
{
1289-
SqlConnectionFactory.SingletonInstance.ClearAllPools();
1289+
SqlConnectionFactory.Instance.ClearAllPools();
12901290
}
12911291

12921292
/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlConnection.xml' path='docs/members[@name="SqlConnection"]/ClearPool/*' />
@@ -1297,7 +1297,7 @@ public static void ClearPool(SqlConnection connection)
12971297
DbConnectionOptions connectionOptions = connection.UserConnectionOptions;
12981298
if (connectionOptions != null)
12991299
{
1300-
SqlConnectionFactory.SingletonInstance.ClearPool(connection);
1300+
SqlConnectionFactory.Instance.ClearPool(connection);
13011301
}
13021302
}
13031303

@@ -2279,7 +2279,7 @@ public static void ChangePassword(string connectionString, string newPassword)
22792279

22802280
SqlConnectionPoolKey key = new SqlConnectionPoolKey(connectionString, credential: null, accessToken: null, accessTokenCallback: null, sspiContextProvider: null);
22812281

2282-
SqlConnectionString connectionOptions = SqlConnectionFactory.FindSqlConnectionOptions(key);
2282+
SqlConnectionString connectionOptions = SqlConnectionFactory.Instance.FindSqlConnectionOptions(key);
22832283
if (connectionOptions.IntegratedSecurity)
22842284
{
22852285
throw SQL.ChangePasswordConflictsWithSSPI();
@@ -2328,7 +2328,7 @@ public static void ChangePassword(string connectionString, SqlCredential credent
23282328

23292329
SqlConnectionPoolKey key = new SqlConnectionPoolKey(connectionString, credential, accessToken: null, accessTokenCallback: null, sspiContextProvider: null);
23302330

2331-
SqlConnectionString connectionOptions = SqlConnectionFactory.FindSqlConnectionOptions(key);
2331+
SqlConnectionString connectionOptions = SqlConnectionFactory.Instance.FindSqlConnectionOptions(key);
23322332

23332333
// Check for connection string values incompatible with SqlCredential
23342334
if (!string.IsNullOrEmpty(connectionOptions.UserID) || !string.IsNullOrEmpty(connectionOptions.Password))
@@ -2366,7 +2366,7 @@ private static void ChangePassword(string connectionString, SqlConnectionString
23662366
}
23672367
SqlConnectionPoolKey key = new SqlConnectionPoolKey(connectionString, credential, accessToken: null, accessTokenCallback: null, sspiContextProvider: null);
23682368

2369-
SqlConnectionFactory.SingletonInstance.ClearPool(key);
2369+
SqlConnectionFactory.Instance.ClearPool(key);
23702370
}
23712371

23722372
internal Task<T> RegisterForConnectionCloseNotification<T>(Task<T> outerTask, object value, int tag)
@@ -2559,11 +2559,10 @@ internal object GetUdtValue(object value, SqlMetaDataPriv metaData, bool returnD
25592559
}
25602560
}
25612561

2562-
internal byte[] GetBytes(object o, out Format format, out int maxSize)
2562+
internal byte[] GetBytes(object o, out int maxSize)
25632563
{
25642564
SqlUdtInfo attr = GetInfoFromType(o.GetType());
25652565
maxSize = attr.MaxByteSize;
2566-
format = attr.SerializationFormat;
25672566

25682567
if (maxSize < -1 || maxSize >= ushort.MaxValue)
25692568
{

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnectionHelper.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace Microsoft.Data.SqlClient
1717
{
1818
public sealed partial class SqlConnection : DbConnection
1919
{
20-
private static readonly DbConnectionFactory s_connectionFactory = SqlConnectionFactory.SingletonInstance;
20+
private static readonly SqlConnectionFactory s_connectionFactory = SqlConnectionFactory.Instance;
2121

2222
private DbConnectionOptions _userConnectionOptions;
2323
private DbConnectionPoolGroup _poolGroup;
@@ -42,7 +42,7 @@ internal int CloseCount
4242
}
4343
}
4444

45-
internal DbConnectionFactory ConnectionFactory
45+
internal SqlConnectionFactory ConnectionFactory
4646
{
4747
get
4848
{
@@ -156,9 +156,7 @@ override protected DbCommand CreateDbCommand()
156156
{
157157
using (TryEventScope.Create("<prov.DbConnectionHelper.CreateDbCommand|API> {0}", ObjectID))
158158
{
159-
DbCommand command = null;
160-
DbProviderFactory providerFactory = ConnectionFactory.ProviderFactory;
161-
command = providerFactory.CreateCommand();
159+
DbCommand command = SqlClientFactory.Instance.CreateCommand();
162160
command.Connection = this;
163161
return command;
164162
}

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3080,9 +3080,13 @@ internal bool ThreadHasParserLockForClose
30803080
}
30813081
}
30823082

3083-
internal override bool TryReplaceConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource<DbConnectionInternal> retry, DbConnectionOptions userOptions)
3083+
internal override bool TryReplaceConnection(
3084+
DbConnection outerConnection,
3085+
SqlConnectionFactory connectionFactory,
3086+
TaskCompletionSource<DbConnectionInternal> retry,
3087+
DbConnectionOptions userOptions)
30843088
{
3085-
return base.TryOpenConnectionInternal(outerConnection, connectionFactory, retry, userOptions);
3089+
return TryOpenConnectionInternal(outerConnection, connectionFactory, retry, userOptions);
30863090
}
30873091
}
30883092

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9943,7 +9943,6 @@ private Task TDSExecuteRPCAddParameter(TdsParserStateObject stateObj, SqlParamet
99439943
{
99449944
int maxSupportedSize = Is2008OrNewer ? int.MaxValue : short.MaxValue;
99459945
byte[] udtVal = null;
9946-
Format format = Format.Native;
99479946

99489947
if (string.IsNullOrEmpty(param.UdtTypeName))
99499948
{
@@ -9977,7 +9976,7 @@ private Task TDSExecuteRPCAddParameter(TdsParserStateObject stateObj, SqlParamet
99779976
}
99789977
else
99799978
{
9980-
udtVal = _connHandler.Connection.GetBytes(value, out format, out maxsize);
9979+
udtVal = _connHandler.Connection.GetBytes(value, out maxsize);
99819980
}
99829981

99839982
Debug.Assert(udtVal != null, "GetBytes returned null instance. Make sure that it always returns non-null value");

src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,6 @@
285285
<Compile Include="$(CommonSourceRoot)\Microsoft\Data\ProviderBase\DbConnectionClosed.cs">
286286
<Link>Microsoft\Data\ProviderBase\DbConnectionClosed.cs</Link>
287287
</Compile>
288-
<Compile Include="$(CommonSourceRoot)\Microsoft\Data\ProviderBase\DbConnectionFactory.cs">
289-
<Link>Microsoft\Data\ProviderBase\DbConnectionFactory.cs</Link>
290-
</Compile>
291288
<Compile Include="$(CommonSourceRoot)Microsoft\Data\ProviderBase\DbConnectionInternal.cs">
292289
<Link>Microsoft\Data\ProviderBase\DbConnectionInternal.cs</Link>
293290
</Compile>

0 commit comments

Comments
 (0)