Released: General Availability of Microsoft.Data.SqlClient 5.0
Published Aug 08 2022 09:40 AM 1,666 Views
New Contributor

We have released for general availability Microsoft.Data.SqlClient 5.0. This .NET Data Provider for SQL Server provides general connectivity to the database and supports all the latest SQL Server features for applications targeting .NET, .NET Framework, .NET Core, and .NET Standard.

 

To try out the new package, add a NuGet reference to Microsoft.Data.SqlClient in your application.

 

If you've been following our preview releases, you know we've been busy working to add features and improve stability and performance of the Microsoft.Data.SqlClient library.

 

Highlights

 

Some of the highlights of new features in 5.0 over the 4.0 release of Microsoft.Data.SqlClient include:

  • Added support for TDS 8.0. To use TDS 8.0, users should specify Encrypt=Strict in the connection string. Read more
  • Added support for specifying Server SPN and Failover Server SPN on the connection. Read more
  • Added support for aliases when targeting .NET Core on Windows. Read more
  • Added support for SqlDataSourceEnumerator on Windows. Read more
  • Added new attestation protocol None option to forgo enclave attestation when using VBS enclaves. Read more

 

Breaking Changes

 

SqlConnectionStringBuilder.Encrypt property change

As part of the TDS 8.0 feature, the SqlConnectionStringBuilder.Encrypt property has changed from a bool to a SqlConnectionEncryptOption. SqlConnectionEncryptOption has implicit conversion rules to convert to/from a bool so that existing code remains backwards compatible, however this is a binary-breaking change and a recompile is required against this version.

 

Microsoft.SqlServer.Server dependency

There is one significant breaking change in 5.0 over previous releases. We added a dependency on the Microsoft.SqlServer.Server package. This new dependency may cause namespace conflicts if your application references that namespace and still has package references (direct or indirect) to System.Data.SqlClient from .NET Core.

 

Bringing in the dependency required dropping classes from the Microsoft.Data.SqlClient.Server namespace and replacing them with supported types from the Microsoft.SqlServer.Server package. For a list of the affected classes, see the breaking changes section of the release notes.

 

The reason there was a Microsoft.Data.SqlClient.Server namespace at all was because in Microsoft.Data.SqlClient 1.0, we needed some of the classes from Microsoft.SqlServer.Server to minimally support UDTs. Microsoft.SqlServer.Server lives inside the System.Data.SqlClient package from .NET Core. We couldn't bring Microsoft.SqlServer.Server into Microsoft.Data.SqlClient because that would have meant Microsoft.Data.SqlClient couldn't live alongside System.Data.SqlClient in dependency trees without causing namespace conflicts. That would mean migrations from System.Data.SqlClient to Microsoft.Data.SqlClient would have to be all-or-nothing affairs, a huge feat for large applications with many dependencies. We also did not want Microsoft.Data.SqlClient to have a dependency on System.Data.SqlClient because System.Data.SqlClient was going into maintenance mode and that kind of dependency would just look bad.

 

Fast forward 3 years and Microsoft.SqlServer.Types needs to support .NET Core in order to support spatial types on .NET Core. Microsoft.SqlServer.Types has a dependency on Microsoft.SqlServer.Server. It couldn't simply migrate to the classes in Microsoft.Data.SqlClient.Server because of the tight ties it has to .NET Framework and the inner workings of SQL Server itself. Breaking out Microsoft.SqlServer.Server into its own package was the best forward.

 

You might be wondering why System.Data.SqlClient can't also be changed to take a dependency on Microsoft.SqlServer.Server. Well, due to the tight coupling of System.Data.SqlClient and .NET Core itself, that change becomes a potential breaking change. There is much resistance to any changes to System.Data.SqlClient, much less breaking changes, since it is in maintenance mode. That leaves us with Microsoft.Data.SqlClient 5.0 being incompatible with System.Data.SqlClient.

 

Minor Breaking Changes

There is one minor breaking changes in 5.0 over previous releases:

  • Support for .NET Framework 4.6.1 has been dropped.

 

 

For the full list of added features, fixes, and changes in Microsoft.Data.SqlClient 5.0, please see the Release Notes.

 

Again, to try out the new package, add a NuGet reference to Microsoft.Data.SqlClient in your application. If you encounter any issues or have any feedback, head over to the SqlClient GitHub repository and submit an issue.

 

David Engel

 

Co-Authors
Version history
Last update:
‎Aug 09 2022 12:40 PM
Updated by:
www.000webhost.com