This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Tech Community.
We have released for general availability Microsoft.Data.SqlClient 4.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 Framework, .NET Core, .NET Standard, and .NET.
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.
Some of the highlights of new features in 4.0 over the 3.0 release of Microsoft.Data.SqlClient include:
- Added `SqlCommand.EnableOptimizedParameterBinding` property that when enabled increases performance for commands with very large numbers of parameters. Read more
- Added `PoolBlockingPeriod` connection property support in .NET Standard.
- Added support for `SqlDataReader.GetColumnSchema()` in .NET Standard.
- Added PropertyGrid support with component model annotations to `SqlConnectionStringBuilder` properties for .NET Core.
- Added support for `SqlFileStream` on Windows using .NET Standard 2.0 and above.
- Added `GetFieldValueAsync<T>` and `GetFieldValue<T>` support for `XmlReader`, `TextReader`, and `Stream` types. Read more
Encrypt = true, by default
There is one major breaking change in 4.0 over previous releases. Similar to the HTTP to HTTPS default changes made in web browsers a few years back (and the security reasons for them), we are changing the default value of the `Encrypt` connection option from `false` to `true`. With the increased emphasis on secure-by-default, the growing use of cloud databases, and the need to ensure connections are secure, it's time for this backwards-compatibility-breaking change. We realize this will cause some disruption, but letting clients try to connect without encryption by default leaves them open to attack from malicious actors. In conjunction to the TrustServerCertificate behavior change introduced in 3.0, those upgrading from older versions are very likely to notice the change if they are relying on the defaults and are not already using trusted certificates on their servers.
The action item if you are affected by the Encrypt change is to either (in order of recommendation):
- Install a trusted certificate on your server.
- Change your client's Encrypt connection string setting (or Connection property) to false.
If you are using a self-signed certificate and the Force Protocol Encryption setting on the server to ensure clients connect with encryption, you will need to do one of the following (in order of recommendation):
- Change to a certificate that is trusted as part of the client's trust chain.
- Add the self-signed certificate as a trusted certificate on the client.
- Change your client's TrustServerCertificate connection string setting (or Connection property) to true.
If you maintain an application that uses Microsoft.Data.SqlClient and you don't expose the Encrypt and TrustServerCertificate settings to your users, it's recommended that you make application changes to allow users to opt-in to non-encrypted connections or connections that use an untrusted certificate.
To learn more encrypting connections, see the SQL Server documentation on enabling encrypted connections to the database.
Minor Breaking Changes
There are a few minor breaking changes in 4.0 over previous releases.
- The driver now throws
AggregateExceptionfor Active Directory authentication modes.
- The obsolete
Asynchronous Processingconnection property has been dropped from .NET Framework.
- Support for .NET Core 2.1 has been dropped.
For the full list of added features, fixes, and changes in Microsoft.Data.SqlClient 4.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.