In the Era of .NET Core, Microsoft Revamps SQL Server Data Access

Microsoft announced a new data access driver for SQL Server that should be the path forward for data developers in the era of .NET Core.

As the traditional, Windows-only .NET Framework is basically being relegated to maintenance mode while the company devotes new development resources to the open source, cross-platform .NET Core, the SQL Server team needed a way to move to a single codebase to serve both camps.

That hasn't happened yet, but it's in the works. In the meantime, a preview of the new Microsoft.Data.SqlClient package is available via NuGet, providing the way forward instead of System.Data.SqlClient, the ADO.NET provider used to access SQL Server or Azure SQL Databases in .NET Framework.

"This new package supports both .NET Core and .NET Framework," said Vicky Harp, program manager on SqlClient and SQL Server Tools, in a blog post earlier this month. "Creating a new SqlClient in a new namespace allows both the old System.Data.SqlClient and new Microsoft.Data.SqlClient to live side-by-side. While not automatic, there is a pretty straightforward path for applications to move from the old to the new. Simply add a NuGet dependency on Microsoft.Data.SqlClient and update any using references or qualified references."

Also, as part of the aforementioned new development direction, she announced new functionality for the .NET Core version of the provider, the "long-awaited support for Always Encrypted" and support for Enclaves, "a protected region of memory within the SQL Server process [that] acts as a trusted execution environment for processing sensitive data inside the SQL Server engine."

She also announced two new features for SQL Server working on both .NET Framework and .NET Core:

  • Data Classification -- Available in Azure SQL Database and Microsoft SQL Server 2019 since CTP 2.0.
  • UTF-8 support -- Available in Microsoft SQL Server SQL Server 2019 since CTP 2.3.

Regarding the long-term goal of a unified code base, she said:

The binaries in the new package are based on the same code from System.Data.SqlClient in .NET Core and .NET Framework. This means there are multiple binaries in the package. In addition to the different binaries you would expect for supporting different operating systems, there are different binaries when you target .NET Framework versus when you target .NET Core. There was no magic code merge behind the scenes: we still have divergent code bases from .NET Framework and .NET Core (for now). This also means we still have divergent feature support between SqlClient targeting .NET Framework and SqlClient targeting .NET Core. If you want to migrate from .NET Framework to .NET Core but you are blocked because .NET Core does not yet support a feature (aside from Always Encrypted), the first preview release may not change that. But our top priority is bringing feature parity across those targets.

System.Data.SqlClient, for now, will continue to be supported, but only for fixing bugs and security issues, with all new development going to Microsoft.Data.SqlClient.

"Our roadmap has more frequent releases lighting up features in Core as fast as we can implement them," Harp said. "The long-term goal is a single code base and it will come to that over time, but the immediate need is feature support in SqlClient on .NET Core, so that is what we are focusing on, while still being able to deliver new SQL features to .NET Framework applications, too."

The Microsoft.Data.SqlClient feature roadmap calls for:

  • Azure Active Directory authentication providers (Core)
  • Active Directory Password
  • Managed Service Identity
  • Active Directory Integrated

In addition to the aforementioned merging of the SQL Server .NET Framework and .NET Core code bases, the engineering roadmap calls for open source assembly and a move to GitHub.

Microsoft.Data.SqlClient is set to graduate from preview to general availability sometime before the final releases of both SQL Server 2019 and .NET Core 3.0, both scheduled for the second half of this year.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus


Subscribe on YouTube