Moving to a New SqlClient

DotNet developers, if you’re using the System.Data.SqlClient, stop. Move over to Microsoft.Data.SqlClient now.

It’s easy to do, well, it’s relatively easy to say that. The actual work isn’t that hard, but it can be a challenge to move assemblies. In any case,  you need to reference the new assembly in your code, and ensure you’ve downloaded the NuGet package.

Vicky Harp wrote a piece introducing this new provider, and you can find plenty of posts around the Internet (and videos) that explain how to change and why.

Essentially, when you have the new assembly, you change this line:

Using System.Data.SqlClient;

to this:


If you haven’t fully qualified the assembly at the top and did it in code, you can search and replace.

The big reason for the change is to allow the ADO.NET provider to release quicker and keep up with changes in technology. When the SqlClient has shipped with dotNet or dotNet Core, it upgraded rather rarely, and the pace of change was disconnected from features being added to SQL Server. Now Vicky’s team has responsibility here and is upgrading this at a more rapid pace.

Let your friends know, and if you see System.Data.SqlClient in a code review, consider trying to refactor that out.

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , , . Bookmark the permalink.