This update brings the below changes over the previous release:
- Added support for Always Encrypted with secure enclaves on Unix for .NET Core 2.1+ and on all supported platforms for .NET Standard 2.1+ #676 [Read more]
- Added support for Azure Active Directory Device Code Flow authentication #597 [Read more]
- Added new APIs to enable customizations for "Active Directory Interactive" authentication experience #597 Read more
- Added Sensitivity Rank support in Sensitivity Classification information #626 [Read more]
- Added support to obtain
ServerProcessId()
(SPID) information on an activeSqlConnection
instance #660 [Read more] - Added support for a new Configuration Section,
SqlClientAuthenticationProviders
(duplicate of existingSqlAuthenticationProviders
), to allow co-existence of configurations for both drivers, "System.Data.SqlClient" and "Microsoft.Data.SqlClient" #702 [Read more] - Added TraceLogging in Native SNI to extend
SqlClientEventSource
support #650 [Read more] - Updated Microsoft.Data.SqlClient.SNI (.NET Framework dependency) and Microsoft.Data.SqlClient.SNI.runtime (.NET Core/Standard dependency) version to v2.1.0 with trace logging implementation #705
- Fixed Enclave session cache issue with Azure Database #686
- Fixed pooled connection re-use on access token expiry issue when using Active Directory authentication modes #635
- Fixed transient fault handling for Pooled connections #637
- Fixed SPN generation issue when no port is provided #629
- Fixed missing null checks for
SqlErrors
inSqlException
for .NET Framework implementation #698
- Performance improvements by fixing unnecessary allocations with EventSource implementation #684
- Reverted changes to return empty DataTable from GetSchemaTable to return null as before. #696
- Removed multiple
CacheConnectionStringProperties
calls when settingConnectionString
properties #683 - Code Improvements by only checking inexact match when no exact match is found for an embedded resource #668
- Changed
_SqlMetaData
to lazy initialize hidden column map #521 - Renamed internal string resource file and helpers for .NET Core implementation #671
- Performance improvements by reworking
ExecuteReaderAsync
to minimize allocations #528 - Performance improvements by moving
DataReader
caches to internal connection #499 - Moved common files to shared folder between .NET Framework and .NET Core implementation #618 #625
Microsoft.Data.SqlClient v2.1 extends support for Always Encrypted (including with secure enclaves) on the following platforms:
Target Framework | Platform | New Feature support |
---|---|---|
.NET Framework v4.6+ | Windows | No changes |
.NET Core 2.1+ | All Operating Systems | Yes, Support on Linux/MacOS |
.NET Standard 2.1+ | All Operating Systems | Yes, Support on All Operating Systems |
Microsoft.Data.SqlClient v2.1 provides support for "Device Code Flow" authentication with MSAL.NET. Reference documentation: OAuth2.0 Device Authorization Grant flow
Connection string example:
Server=<server>.database.windows.net; Authentication=Active Directory Device Code Flow; Database=Northwind;
The following API enables customization of the Device Code Flow callback mechanism:
public class ActiveDirectoryAuthenticationProvider
{
// For .NET Framework, .NET Core and .NET Standard targeted applications
public void SetDeviceCodeFlowCallback(Func<DeviceCodeResult, Task> deviceCodeFlowCallbackMethod)
}
Microsoft.Data.SqlClient v2.1 provides the following new APIs to enable customizations for the "Active Directory Interactive" authentication experience:
public class ActiveDirectoryAuthenticationProvider
{
// For .NET Framework targeted applications only
public void SetIWin32WindowFunc(Func<IWin32Window> iWin32WindowFunc);
// For .NET Standard targeted applications only
public void SetParentActivityOrWindowFunc(Func<object> parentActivityOrWindowFunc);
// For .NET Framework, .NET Core and .NET Standard targeted applications
public void SetAcquireAuthorizationCodeAsyncCallback(Func<Uri, Uri, CancellationToken, Task<Uri>> acquireAuthorizationCodeAsyncCallback);
}
Microsoft.Data.SqlClient v2.1 introduces support for Data Classification's "Sensitivity Rank" information. The following new APIs are now available:
public class SensitivityClassification
{
public SensitivityRank SensitivityRank;
}
public class SensitivityProperty
{
public SensitivityRank SensitivityRank;
}
public enum SensitivityRank
{
NOT_DEFINED = -1,
NONE = 0,
LOW = 10,
MEDIUM = 20,
HIGH = 30,
CRITICAL = 40
}
Microsoft.Data.SqlClient v2.1 introduces a new SqlConnection
property, ServerProcessId
, on an active connection.
public class SqlConnection
{
// Returns the server process Id (SPID) of the active connection.
public int ServerProcessId;
}
Microsoft.Data.SqlClient v2.1 extends the existing SqlClientEventSource
implementation to enable event tracing in SNI.dll. Events must be captured using a tool like Xperf.
Tracing can be enabled by sending a command to SqlClientEventSource
as illustrated below:
// Enables trace events:
EventSource.SendCommand(eventSource, (EventCommand)8192, null);
// Enables flow events:
EventSource.SendCommand(eventSource, (EventCommand)16384, null);
// Enables both trace and flow events:
EventSource.SendCommand(eventSource, (EventCommand)(8192 | 16384), null);
Microsoft.Data.SqlClient v2.1 introduces a new configuration section, SqlClientAuthenticationProviders
(a clone of the existing SqlAuthenticationProviders
). The existing configuration section, SqlAuthenticationProviders
, is still supported for backwards compatibility when the appropriate type is defined.
The new section allows application config files to contain both a SqlAuthenticationProviders section for System.Data.SqlClient and a SqlClientAuthenticationProviders section for Microsoft.Data.SqlClient.
- .NET Framework 4.6+ (Windows x86, Windows x64)
- .NET Core 2.1+ (Windows x86, Windows x64, Windows ARM64, Windows ARM, Linux, macOS)
- .NET Standard 2.0+ (Windows x86, Windows x64, Windows ARM64, Windows ARM, Linux, macOS)
- Microsoft.Data.SqlClient.SNI 2.1.0
- Microsoft.Identity.Client 4.14.0
- Microsoft.IdentityModel.Protocols.OpenIdConnect 5.6.0
- Microsoft.IdentityModel.JsonWebTokens 5.6.0
- Microsoft.Data.SqlClient.SNI.runtime 2.1.0
- Microsoft.Win32.Registry 4.7.0
- System.Security.Principal.Windows 4.7.0
- System.Text.Encoding.CodePages 4.7.0
- System.Diagnostics.DiagnosticSource 4.7.0
- System.Configuration.ConfigurationManager 4.7.0
- System.Runtime.Caching 4.7.0
- Microsoft.Identity.Client 4.14.0
- Microsoft.IdentityModel.Protocols.OpenIdConnect 5.6.0
- Microsoft.IdentityModel.JsonWebTokens 5.6.0
- Microsoft.Data.SqlClient.SNI.runtime 2.1.0
- Microsoft.Win32.Registry 4.7.0
- System.Security.Principal.Windows 4.7.0
- System.Text.Encoding.CodePages 4.7.0
- System.Diagnostics.DiagnosticSource 4.7.0
- System.Configuration.ConfigurationManager 4.7.0
- System.Runtime.Caching 4.7.0
- Microsoft.Identity.Client 4.14.0
- Microsoft.IdentityModel.Protocols.OpenIdConnect 5.6.0
- Microsoft.IdentityModel.JsonWebTokens 5.6.0
- Microsoft.Data.SqlClient.SNI.runtime 2.1.0
- Microsoft.Win32.Registry 4.7.0
- System.Buffers 4.5.1
- System.Memory 4.5.4
- System.Security.Principal.Windows 4.7.0
- System.Text.Encoding.CodePages 4.7.0
- Microsoft.Identity.Client 4.14.0
- Microsoft.IdentityModel.Protocols.OpenIdConnect 5.6.0
- Microsoft.IdentityModel.JsonWebTokens 5.6.0
- Microsoft.Data.SqlClient.SNI.runtime 2.1.0
- Microsoft.Win32.Registry 4.7.0
- System.Buffers 4.5.1
- System.Memory 4.5.4
- System.Security.Principal.Windows 4.7.0
- System.Text.Encoding.CodePages 4.7.0
- Microsoft.Identity.Client 4.14.0
- Microsoft.IdentityModel.Protocols.OpenIdConnect 5.6.0
- Microsoft.IdentityModel.JsonWebTokens 5.6.0