diff --git a/doc/snippets/Microsoft.Data.SqlClient/SqlConnection.xml b/doc/snippets/Microsoft.Data.SqlClient/SqlConnection.xml
index 05f3c774b0..5f88a1498e 100644
--- a/doc/snippets/Microsoft.Data.SqlClient/SqlConnection.xml
+++ b/doc/snippets/Microsoft.Data.SqlClient/SqlConnection.xml
@@ -1033,7 +1033,7 @@ The following table lists the valid names for keyword values within the
-or-
ServerSPN|N/A|The SPN for the data source. The default value is an empty string, which causes SqlClient to use the default, driver-generated SPN.
(Only available in v5.0+)|
|Transaction Binding|Implicit Unbind|Controls connection association with an enlisted `System.Transactions` transaction.
Possible values are:
`Transaction Binding=Implicit Unbind;`
`Transaction Binding=Explicit Unbind;`
Implicit Unbind causes the connection to detach from the transaction when it ends. After detaching, additional requests on the connection are performed in autocommit mode. The `System.Transactions.Transaction.Current` property is not checked when executing requests while the transaction is active. After the transaction has ended, additional requests are performed in autocommit mode.
If the system ends the transaction (in the scope of a using block) before the last command completes, it will throw .
Explicit Unbind causes the connection to remain attached to the transaction until the connection is closed or an explicit `SqlConnection.TransactionEnlist(null)` is called. Beginning in .NET Framework 4.0, changes to Implicit Unbind make Explicit Unbind obsolete. An `InvalidOperationException` is thrown if `Transaction.Current` is not the enlisted transaction or if the enlisted transaction is not active.|
-|Transparent Network IP Resolution
-or-
TransparentNetworkIPResolution|See description.|On .NET Framework, when the value of this key is set to `true`, the driver runs multiple connect rounds across the DNS-resolved IP addresses, with progressively larger per-attempt timeouts and a 500 ms minimum on the sequential-mode attempt, until a connection succeeds or the overall `Connect Timeout` is reached.
If the `MultiSubnetFailover` key is set to `true`, `TransparentNetworkIPResolution` is ignored.
If the `Failover Partner` key is set, `TransparentNetworkIPResolution` is ignored.
On .NET Framework, if `TransparentNetworkIPResolution` isn't specified in the connection string, the driver automatically disables TNIR when the data source is an Azure SQL endpoint (`.database.windows.net`, `.database.cloudapi.de`, `.database.usgovcloudapi.net`, `.database.chinacloudapi.cn`, or `.database.fabric.microsoft.com`), when the `Authentication` key is set to any Microsoft Entra ID method (`Active Directory Password`, `Active Directory Integrated`, `Active Directory Interactive`, `Active Directory Service Principal`, `Active Directory Device Code Flow`, `Active Directory Managed Identity`, `Active Directory MSI`, `Active Directory Default`, or `Active Directory Workload Identity`), or when the or property is set on the . For these automatic conditions, an explicit `TransparentNetworkIPResolution` value bypasses the automatic behavior: `True` enables TNIR, and `False` disables TNIR unconditionally. To restore the automatic behavior, remove the keyword from the connection string.
On .NET (Core, .NET 5+), `TransparentNetworkIPResolution` isn't a recognized connection-string keyword. Setting it (with any value) throws `ArgumentException` when the driver parses the connection string.
On .NET Framework, the value of this key must be `true`, `false`, `yes`, or `no`.
A value of `yes` is treated the same as a value of `true`.
A value of `no` is treated the same as a value of `false`.|
+|Transparent Network IP Resolution
-or-
TransparentNetworkIPResolution|See description.|**Deprecated.** Use `Multi Subnet Failover` instead.
On .NET Framework, when the value of this key is set to `true`, the driver runs multiple connect rounds across the DNS-resolved IP addresses, with progressively larger per-attempt timeouts and a 500 ms minimum on the sequential-mode attempt, until a connection succeeds or the overall `Connect Timeout` is reached.
If the `MultiSubnetFailover` key is set to `true`, `TransparentNetworkIPResolution` is ignored.
If the `Failover Partner` key is set, `TransparentNetworkIPResolution` is ignored.
On .NET Framework, if `TransparentNetworkIPResolution` isn't specified in the connection string, the driver automatically disables TNIR when the data source is an Azure SQL endpoint (`.database.windows.net`, `.database.cloudapi.de`, `.database.usgovcloudapi.net`, `.database.chinacloudapi.cn`, or `.database.fabric.microsoft.com`), when the `Authentication` key is set to any Microsoft Entra ID method (`Active Directory Password`, `Active Directory Integrated`, `Active Directory Interactive`, `Active Directory Service Principal`, `Active Directory Device Code Flow`, `Active Directory Managed Identity`, `Active Directory MSI`, `Active Directory Default`, or `Active Directory Workload Identity`), or when the or property is set on the . For these automatic conditions, an explicit `TransparentNetworkIPResolution` value bypasses the automatic behavior: `True` enables TNIR, and `False` disables TNIR unconditionally. To restore the automatic behavior, remove the keyword from the connection string.
On .NET (Core, .NET 5+), `TransparentNetworkIPResolution` isn't a recognized connection-string keyword. Setting it (with any value) throws when the driver parses the connection string.
On .NET Framework, the value of this key must be `true`, `false`, `yes`, or `no`.
A value of `yes` is treated the same as a value of `true`.
A value of `no` is treated the same as a value of `false`.|
|Trust Server Certificate
-or-
TrustServerCertificate|'false'|When set to `true`, TLS is used to encrypt the channel when bypassing walking the certificate chain to validate trust. If TrustServerCertificate is set to `true` and Encrypt is set to `false`, the channel is not encrypted. Recognized values are `true`, `false`, `yes`, and `no`. For more information, see [Connection String Syntax](https://learn.microsoft.com/sql/connect/ado-net/connection-string-syntax).|
|Type System Version|N/A|A string value that indicates the type system the application expects. The functionality available to a client application is dependent on the version of SQL Server and the compatibility level of the database. Explicitly setting the type system version that the client application was written for avoids potential problems that could cause an application to break if a different version of SQL Server is used. **Note:** The type system version cannot be set for common language runtime (CLR) code executing in-process in SQL Server. For more information, see [SQL Server Common Language Runtime Integration](https://learn.microsoft.com/dotnet/framework/data/adonet/sql/sql-server-common-language-runtime-integration).
Possible values are:
`Type System Version=SQL Server 2012;`
`Type System Version=SQL Server 2008;`
`Type System Version=SQL Server 2005;`
`Type System Version=Latest;`
`Type System Version=SQL Server 2012;` specifies that the application will require version 11.0.0.0 of Microsoft.SqlServer.Types.dll. The other `Type System Version` settings will require version 10.0.0.0 of Microsoft.SqlServer.Types.dll.
`Latest` is obsolete and should not be used. `Latest` is equivalent to `Type System Version=SQL Server 2008;`.|
|User ID
-or-
UID
-or-
User|N/A|The SQL Server login account. Not recommended. To maintain a high level of security, we strongly recommend that you use the `Integrated Security` or `Trusted_Connection` keywords instead. is a more secure way to specify credentials for a connection that uses SQL Server Authentication.
The user ID must be 128 characters or less.|
diff --git a/doc/snippets/Microsoft.Data.SqlClient/SqlConnectionStringBuilder.xml b/doc/snippets/Microsoft.Data.SqlClient/SqlConnectionStringBuilder.xml
index 1387196677..ffeb1ad240 100644
--- a/doc/snippets/Microsoft.Data.SqlClient/SqlConnectionStringBuilder.xml
+++ b/doc/snippets/Microsoft.Data.SqlClient/SqlConnectionStringBuilder.xml
@@ -1416,6 +1416,9 @@ This property corresponds to the "ServerSPN" and "Server SPN" keys within the co
A boolean value.
+
+ This property is obsolete. Use instead.
+
If the Multi Subnet Failover key is set to true, Transparent Network IP Resolution is ignored.
diff --git a/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.cs b/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.cs
index a5e3f1a473..266d0b9a1d 100644
--- a/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.cs
+++ b/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.cs
@@ -1492,6 +1492,7 @@ public override void Clear() { }
#if NETFRAMEWORK
///
+ [System.ObsoleteAttribute("TransparentNetworkIPResolution has been deprecated and is only supported on .NET Framework. Use MultiSubnetFailover instead.")]
[System.ComponentModel.DisplayNameAttribute("Transparent Network IP Resolution")]
[System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)]
public bool TransparentNetworkIPResolution { get { throw null; } set { } }
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionStringBuilder.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionStringBuilder.cs
index 4038dbb295..bb4871ed4a 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionStringBuilder.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionStringBuilder.cs
@@ -411,7 +411,9 @@ private object GetAt(Keywords index)
return ConnectionReset;
#pragma warning restore 618
case Keywords.TransparentNetworkIPResolution:
+#pragma warning disable 618 // Obsolete properties
return TransparentNetworkIPResolution;
+#pragma warning restore 618
case Keywords.NetworkLibrary:
return NetworkLibrary;
#endif
@@ -1083,7 +1085,9 @@ public override object this[string keyword]
NetworkLibrary = ConvertToString(value);
break;
case Keywords.TransparentNetworkIPResolution:
+#pragma warning disable 618 // Obsolete properties
TransparentNetworkIPResolution = ConvertToBoolean(value);
+#pragma warning restore 618
break;
#endif
default:
@@ -1879,6 +1883,7 @@ public bool ConnectionReset
}
///
+ [Obsolete("TransparentNetworkIPResolution has been deprecated and is only supported on .NET Framework. Use MultiSubnetFailover instead.")]
[DisplayName(DbConnectionStringKeywords.TransparentNetworkIpResolution)]
[ResCategory(nameof(Strings.DataCategory_Source))]
[ResDescription(nameof(Strings.DbConnectionString_TransparentNetworkIPResolution))]
diff --git a/src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/SqlClient/SqlConnectionOptionsTest.cs b/src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/SqlClient/SqlConnectionOptionsTest.cs
index 11b4ed8637..4c15a65789 100644
--- a/src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/SqlClient/SqlConnectionOptionsTest.cs
+++ b/src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/SqlClient/SqlConnectionOptionsTest.cs
@@ -59,7 +59,9 @@ public void TestDefaultTnir(string dataSource, bool? tnirEnabledInConnString, bo
builder.DataSource = dataSource;
if (tnirEnabledInConnString.HasValue)
{
+#pragma warning disable 618 // TransparentNetworkIPResolution is obsolete
builder.TransparentNetworkIPResolution = tnirEnabledInConnString.Value;
+#pragma warning restore 618
}
SqlConnectionOptions connectionString = new(builder.ConnectionString);
@@ -99,7 +101,9 @@ public void TestShouldDisableTnirWithCallerSuppliedToken(
SqlConnectionStringBuilder builder = new() { DataSource = dataSource };
if (tnirInConnString.HasValue)
{
+#pragma warning disable 618 // TransparentNetworkIPResolution is obsolete
builder.TransparentNetworkIPResolution = tnirInConnString.Value;
+#pragma warning restore 618
}
SqlConnectionOptions connectionOptions = new(builder.ConnectionString);
diff --git a/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionFailoverTests.cs b/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionFailoverTests.cs
index ba1a852626..216a131ad8 100644
--- a/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionFailoverTests.cs
+++ b/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionFailoverTests.cs
@@ -129,7 +129,9 @@ public void NetworkError_TriggersFailover_ClearsPool()
InitialCatalog = "test",
MultiSubnetFailover = false,
#if NETFRAMEWORK
+ #pragma warning disable 618 // TransparentNetworkIPResolution is obsolete
TransparentNetworkIPResolution = false,
+ #pragma warning restore 618
#endif
};
@@ -199,7 +201,9 @@ public void NetworkTimeout_ShouldFail()
Encrypt = false,
MultiSubnetFailover = false,
#if NETFRAMEWORK
+ #pragma warning disable 618 // TransparentNetworkIPResolution is obsolete
TransparentNetworkIPResolution = false,
+ #pragma warning restore 618
#endif
};
using SqlConnection connection = new(builder.ConnectionString);
@@ -246,7 +250,9 @@ public void NetworkDelay_ShouldConnectToPrimary()
Pooling = false, // Disable pooling to ensure a fresh connection attempt is made
MultiSubnetFailover = false,
#if NETFRAMEWORK
+ #pragma warning disable 618 // TransparentNetworkIPResolution is obsolete
TransparentNetworkIPResolution = false,
+ #pragma warning restore 618
#endif
};
using SqlConnection connection = new(builder.ConnectionString);
@@ -388,7 +394,9 @@ public void NetworkError_WithUserProvidedPartner_RetryEnabled_ShouldConnectToFai
FailoverPartner = $"localhost,{failoverServer.EndPoint.Port}", // User provided failover partner
Encrypt = false,
#if NETFRAMEWORK
+ #pragma warning disable 618 // TransparentNetworkIPResolution is obsolete
TransparentNetworkIPResolution = false,
+ #pragma warning restore 618
#endif
};
using SqlConnection connection = new(builder.ConnectionString);
diff --git a/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionRoutingTests.cs b/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionRoutingTests.cs
index 262770f563..918f7228f3 100644
--- a/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionRoutingTests.cs
+++ b/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionRoutingTests.cs
@@ -136,7 +136,9 @@ public void NetworkDelayAtRoutedLocation_RetryDisabled_ShouldSucceed(bool multiS
Encrypt = false,
MultiSubnetFailover = multiSubnetFailoverEnabled,
#if NETFRAMEWORK
+ #pragma warning disable 618 // TransparentNetworkIPResolution is obsolete
TransparentNetworkIPResolution = multiSubnetFailoverEnabled,
+ #pragma warning restore 618
#endif
};
using SqlConnection connection = new(builder.ConnectionString);
@@ -190,7 +192,9 @@ public void NetworkTimeoutAtRoutedLocation_RetryDisabled_ShouldFail()
Encrypt = false,
MultiSubnetFailover = false,
#if NETFRAMEWORK
+ #pragma warning disable 618 // TransparentNetworkIPResolution is obsolete
TransparentNetworkIPResolution = false
+ #pragma warning restore 618
#endif
};
using SqlConnection connection = new(builder.ConnectionString);
diff --git a/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionTests.cs b/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionTests.cs
index f797797758..1a48ccd293 100644
--- a/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionTests.cs
+++ b/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionTests.cs
@@ -111,7 +111,9 @@ public async Task TransientFault_RetryEnabled_ShouldSucceed_Async(uint errorCode
DataSource = "localhost," + server.EndPoint.Port,
Encrypt = SqlConnectionEncryptOption.Optional,
#if NETFRAMEWORK
+ #pragma warning disable 618 // TransparentNetworkIPResolution is obsolete
TransparentNetworkIPResolution = false
+ #pragma warning restore 618
#endif
};
@@ -252,7 +254,9 @@ public async Task NetworkError_RetryEnabled_ShouldSucceed_Async(bool multiSubnet
Pooling = false, // Disable pooling to ensure a fresh connection attempt is made
MultiSubnetFailover = multiSubnetFailoverEnabled,
#if NETFRAMEWORK
+ #pragma warning disable 618 // TransparentNetworkIPResolution is obsolete
TransparentNetworkIPResolution = multiSubnetFailoverEnabled
+ #pragma warning restore 618
#endif
};
@@ -290,7 +294,9 @@ public async Task NetworkDelay_RetryDisabled_Async(bool multiSubnetFailoverEnabl
Encrypt = SqlConnectionEncryptOption.Optional,
MultiSubnetFailover = multiSubnetFailoverEnabled,
#if NETFRAMEWORK
+ #pragma warning disable 618 // TransparentNetworkIPResolution is obsolete
TransparentNetworkIPResolution = multiSubnetFailoverEnabled,
+ #pragma warning restore 618
#endif
};
@@ -338,7 +344,9 @@ public void NetworkDelay_RetryDisabled(bool multiSubnetFailoverEnabled)
ConnectTimeout = 5,
MultiSubnetFailover = multiSubnetFailoverEnabled,
#if NETFRAMEWORK
+ #pragma warning disable 618 // TransparentNetworkIPResolution is obsolete
TransparentNetworkIPResolution = multiSubnetFailoverEnabled,
+ #pragma warning restore 618
#endif
};
diff --git a/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/SNICloseDeadlockTest.cs b/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/SNICloseDeadlockTest.cs
index 465e284b6d..fa333e9215 100644
--- a/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/SNICloseDeadlockTest.cs
+++ b/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/SNICloseDeadlockTest.cs
@@ -119,7 +119,9 @@ public void CloseOrDispose_WithPendingAsyncRead_DoesNotDeadlock(bool disposeInst
// pool.
Pooling = false,
#if NETFRAMEWORK
+ #pragma warning disable 618 // TransparentNetworkIPResolution is obsolete
TransparentNetworkIPResolution = false,
+ #pragma warning restore 618
#endif
};
@@ -292,7 +294,9 @@ public void CloseOrDispose_DuringPreLoginHandshake_DoesNotDeadlock(bool disposeI
ConnectRetryCount = 0,
Pooling = false,
#if NETFRAMEWORK
+ #pragma warning disable 618 // TransparentNetworkIPResolution is obsolete
TransparentNetworkIPResolution = false,
+ #pragma warning restore 618
#endif
};
@@ -502,7 +506,9 @@ public void CloseOrDispose_DuringTlsHandshake_DoesNotDeadlock(bool disposeInstea
ConnectRetryCount = 0,
Pooling = false,
#if NETFRAMEWORK
+ #pragma warning disable 618 // TransparentNetworkIPResolution is obsolete
TransparentNetworkIPResolution = false,
+ #pragma warning restore 618
#endif
};
diff --git a/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/SNICloseHandshakeCancellationTest.cs b/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/SNICloseHandshakeCancellationTest.cs
index 9a41c2f3c7..b11b5ed291 100644
--- a/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/SNICloseHandshakeCancellationTest.cs
+++ b/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/SNICloseHandshakeCancellationTest.cs
@@ -119,7 +119,9 @@ public void CancelOpenAsyncDuringTlsHandshake_DoesNotDeadlock()
ConnectRetryCount = 0,
Pooling = false,
#if NETFRAMEWORK
+ #pragma warning disable 618 // TransparentNetworkIPResolution is obsolete
TransparentNetworkIPResolution = false,
+ #pragma warning restore 618
#endif
};
diff --git a/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/SNICloseRaceDeadlockTest.cs b/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/SNICloseRaceDeadlockTest.cs
index 27ab3a7516..78a099bba4 100644
--- a/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/SNICloseRaceDeadlockTest.cs
+++ b/src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/SNICloseRaceDeadlockTest.cs
@@ -106,7 +106,9 @@ public void ResponseCompletionRacesClose_DoesNotDeadlock(bool disposeInsteadOfCl
// connection (reaching SNIClose) instead of returning it to the pool.
Pooling = false,
#if NETFRAMEWORK
+ #pragma warning disable 618 // TransparentNetworkIPResolution is obsolete
TransparentNetworkIPResolution = false,
+ #pragma warning restore 618
#endif
};