jonwagner / Insight.Database

Fast, lightweight .NET micro-ORM
Other
856 stars 145 forks source link

Microsoft.Data.SqlClient #513

Closed matteoscaramuzza closed 3 months ago

matteoscaramuzza commented 3 months ago

Hi @jonwagner, I see you've released a new version of this package and I've seen that it still uses System.Data.SqlClient instead of the new Microsoft.Data.SqlClient (https://devblogs.microsoft.com/dotnet/introducing-the-new-microsoftdatasqlclient/, https://github.com/dotnet/SqlClient/issues/1963, https://github.com/dotnet/SqlClient/blob/main/porting-cheat-sheet.md) and I was wondering if there is a specific reason for this choice.

I've tried to fork and migrate from System.Data.SqlClient to Microsoft.Data.SqlClient and I haven't encountered any problem. The only breaking change was that I needed to add to the connection string the option TrustServerCertificate=True.

Let me know please.

Thank you

jonwagner commented 3 months ago

There is an Insight provider for both drivers:

We did not change the implementation of the original provider in order to preserve compatibility with old code. However, in v8.0 we did switch the packaging so that the provider for Microsoft.Data.SqlClient is installed by default instead of the legacy one.

So you can just add the Insight.Database package and you will be using the Microsoft.Data.SqlClient provider by default.

matteoscaramuzza commented 3 months ago

Sorry, I didn't notice that Insight.Database.Providers.MsSqlClient.SqlInsightDbProvider references Microsoft.Data.SqlClient.

Thank you for the quick reply.