You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/connect/ado-net/appcontext-switches.md
+51-1Lines changed: 51 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,13 +3,14 @@ title: AppContext switches in SqlClient
3
3
description: Learn about the AppContext switches available in SqlClient and how to use them to modify some default behaviors.
4
4
author: cheenamalhotra
5
5
ms.author: cmalhotra
6
-
ms.date: 08/19/2025
6
+
ms.date: 03/17/2026
7
7
ms.service: sql
8
8
ms.subservice: connectivity
9
9
ms.topic: concept-article
10
10
dev_langs:
11
11
- "csharp"
12
12
ms.custom: sfi-ropc-nochange
13
+
ai-usage: ai-assisted
13
14
---
14
15
# AppContext switches in SqlClient
15
16
@@ -19,6 +20,55 @@ ms.custom: sfi-ropc-nochange
19
20
20
21
The AppContext class allows SqlClient to provide new functionality while continuing to support callers who depend on the previous behavior. Users can opt out of a change in behavior by setting specific AppContext switches.
To set `MultiSubnetFailover=true` globally without modifying individual connection strings, you can enable the AppContext switch **"Switch.Microsoft.Data.SqlClient.EnableMultiSubnetFailoverByDefault"** to `true` at application startup:
Packet multiplexing improves performance for large async read operations such as `ExecuteReaderAsync` with big result sets, streaming scenarios, or bulk data retrieval. This feature is controlled by two opt-in AppContext switches. Setting both switches to `false` enables the new async processing path:
When the AppContext switch **"Switch.Microsoft.Data.SqlClient.EnableUserAgent"** is enabled, the driver sends more detailed user agent strings during connection. This information assists with troubleshooting and quantifying driver usage by version and operating system. This switch is disabled by default. To enable it, set the AppContext switch to `true` at application startup:
Copy file name to clipboardExpand all lines: docs/connect/ado-net/introduction-microsoft-data-sqlclient-namespace.md
+224-1Lines changed: 224 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: Learn about the Microsoft.Data.SqlClient namespace and how it's the
4
4
author: cheenamalhotra
5
5
ms.author: cmalhotra
6
6
ms.reviewer: randolphwest
7
-
ms.date: 11/18/2025
7
+
ms.date: 03/17/2026
8
8
ms.service: sql
9
9
ms.subservice: connectivity
10
10
ms.topic: whats-new
@@ -24,6 +24,229 @@ There are a few differences in less-used APIs compared to System.Data.SqlClient
24
24
25
25
The Microsoft.Data.SqlClient API details can be found in the [.NET API Browser](/dotnet/api/microsoft.data.sqlclient).
26
26
27
+
## Stable Release 7.0.0 - 2026-03-17
28
+
29
+
This is the general availability release of **Microsoft.Data.SqlClient 7.0**, a major milestone for the .NET data provider for SQL Server. This release addresses the most upvoted issue in the repository's history — extracting Azure dependencies from the core package — introduces pluggable SSPI authentication, adds enhanced routing for Azure SQL Hyperscale, and delivers async read performance improvements.
30
+
31
+
Also released as part of this milestone:
32
+
- Released Microsoft.Data.SqlClient.Extensions.Abstractions 1.0.0. See [release notes](../Extensions/Abstractions/1.0/1.0.0.md).
33
+
- Released Microsoft.Data.SqlClient.Extensions.Azure 1.0.0. See [release notes](../Extensions/Azure/1.0/1.0.0.md).
34
+
- Released Microsoft.Data.SqlClient.Internal.Logging 1.0.0. See [release notes](../Internal/Logging/1.0/1.0.0.md).
35
+
- Released Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider 7.0.0. See [release notes](../add-ons/AzureKeyVaultProvider/7.0/7.0.0.md).
36
+
37
+
### Breaking Changes
38
+
39
+
#### Azure Dependencies Removed from Core Package
40
+
41
+
*What Changed:*
42
+
43
+
- The core `Microsoft.Data.SqlClient` package no longer depends on `Azure.Core`, `Azure.Identity`, or their transitive dependencies (e.g., `Microsoft.Identity.Client`, `Microsoft.Web.WebView2`). Azure Active Directory / Entra ID authentication functionality (`ActiveDirectoryAuthenticationProvider` and related types) has been extracted into a new `Microsoft.Data.SqlClient.Extensions.Azure` package.
- Two additional packages were introduced to support this separation: `Microsoft.Data.SqlClient.Extensions.Abstractions` (shared types between the core driver and extensions) and `Microsoft.Data.SqlClient.Internal.Logging` (shared ETW tracing infrastructure).
- All users benefit from a significantly lighter core package. Previously, the Azure dependency chain pulled in numerous assemblies even for applications that only needed basic SQL Server connectivity. This was the [most upvoted open issue](https://github.com/dotnet/SqlClient/issues/1108) in the repository.
62
+
- Users who do not use Entra ID authentication no longer carry Azure-related assemblies in their build output.
63
+
- Users who do use Entra ID authentication can now manage Azure dependency versions independently from the core driver.
64
+
65
+
*Impact:*
66
+
67
+
- Applications using Entra ID authentication (e.g., `ActiveDirectoryInteractive`, `ActiveDirectoryDefault`, `ActiveDirectoryManagedIdentity`, etc.) must now install the `Microsoft.Data.SqlClient.Extensions.Azure` NuGet package separately:
- No code changes are required beyond adding the package reference.
74
+
- If an Entra ID authentication method is used without the Azure package installed, the driver now provides an actionable error message guiding users to install the correct package.
75
+
76
+
#### Other breaking changes
77
+
78
+
- Reverted public visibility of internal interop enums (`IoControlCodeAccess` and `IoControlTransferType`) that were accidentally made public during the project merge.
#### Pluggable Authentication with SspiContextProvider
84
+
85
+
*What Changed:*
86
+
87
+
- Added a public `SspiContextProvider` property on `SqlConnection`, completing the SSPI extensibility work begun in 6.1.0. Applications can now supply a custom SSPI context provider for integrated authentication, enabling custom Kerberos ticket negotiation and NTLM username/password authentication scenarios.
- Users authenticating across untrusted domains, non-domain-joined machines, or cross-platform environments where configuring integrated authentication is difficult.
94
+
- Users running in containers who need manual Kerberos negotiation without deploying sidecars or external ticket-refresh mechanisms.
95
+
- Users who need NTLM username/password authentication to SQL Server, which the driver does not provide natively.
96
+
97
+
*Impact:*
98
+
99
+
- Applications can set a custom `SspiContextProvider` on `SqlConnection` before opening the connection:
- The provider handles the authentication token exchange during integrated authentication. Existing authentication behavior is unchanged when no custom provider is set. See [SspiContextProvider_CustomProvider.cs](../../doc/samples/SspiContextProvider_CustomProvider.cs) for a sample implementation.
108
+
-**Note:** The `SspiContextProvider` is part of the connection pool key. Care should be taken when using this property to ensure the implementation returns a stable identity per resource.
- SqlClient 7.0 compiles and tests against .NET 10, ensuring compatibility.
166
+
167
+
#### Strongly-Typed Diagnostic Events on .NET Framework
168
+
169
+
*What Changed:*
170
+
171
+
- Enabled `SqlClientDiagnosticListener` for `SqlCommand` on .NET Framework, closing a long-standing observability gap where diagnostic events were previously only emitted on .NET Core.
- Brought the 15 strongly-typed diagnostic event classes in the `Microsoft.Data.SqlClient.Diagnostics` namespace — originally introduced for .NET Core in 6.0 — to .NET Framework as part of the codebase merge. Both platforms now use the same strongly-typed event model. The types cover command, connection, and transaction lifecycle events:
- .NET Framework users subscribing to `SqlClientDiagnosticListener` events for observability, distributed tracing, or custom telemetry. These users now have parity with .NET Core, gaining IntelliSense, compile-time safety, and eliminating the need to access diagnostic payloads via reflection or dictionary lookups.
186
+
187
+
*Impact:*
188
+
189
+
- On .NET Framework, `SqlCommand` now emits the same diagnostic events that were previously only available on .NET Core. Subscribers to `DiagnosticListener` events (e.g., `Microsoft.Data.SqlClient.WriteCommandBefore`) receive the strongly-typed objects:
- The types implement `IReadOnlyList<KeyValuePair<string, object>>` for backward compatibility with code that iterates properties generically.
202
+
203
+
#### Other Additions
204
+
205
+
- Added `SqlConfigurableRetryFactory.BaselineTransientErrors` static property exposing the default transient error codes list as a `ReadOnlyCollection<int>`, making it easier to extend the default list with application-specific error codes.
- Added app context switch `Switch.Microsoft.Data.SqlClient.EnableMultiSubnetFailoverByDefault` to set `MultiSubnetFailover=true` globally without modifying connection strings.
- Added app context switch `Switch.Microsoft.Data.SqlClient.IgnoreServerProvidedFailoverPartner` to let the client ignore server-provided failover partner info in Basic Availability Groups.
#### Deprecation of `SqlAuthenticationMethod.ActiveDirectoryPassword`
220
+
221
+
*What Changed:*
222
+
223
+
-`SqlAuthenticationMethod.ActiveDirectoryPassword` (the ROPC flow) is now marked `[Obsolete]` and will generate compiler warnings. This aligns with Microsoft's move toward [mandatory multifactor authentication](https://learn.microsoft.com/entra/identity/authentication/concept-mandatory-multifactor-authentication).
| Developer / CI environments |`Active Directory Default`|
240
+
241
+
- See [Connect to Azure SQL with Microsoft Entra authentication](https://learn.microsoft.com/sql/connect/ado-net/sql/azure-active-directory-authentication) for more information.
242
+
243
+
## Target Platform Support
244
+
245
+
- .NET Framework 4.6.2+ (Windows x86, Windows x64, Windows ARM64)
246
+
- .NET 8.0+ (Windows x86, Windows x64, Windows ARM, Windows ARM64, Linux, macOS)
247
+
248
+
Full release notes, including dependencies, are available in the GitHub Repository: [7.0 Release Notes](https://github.com/dotnet/SqlClient/tree/main/release-notes/7.0).
0 commit comments