jonwagner / Insight.Database

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

Please add support for Microsoft.Data.SqlClient #424

Closed bart-degreed closed 4 years ago

bart-degreed commented 4 years ago

When switching from System.Data.SqlClient to the new Microsoft.Data.SqlClient library (https://devblogs.microsoft.com/dotnet/introducing-the-new-microsoftdatasqlclient/), existing code breaks with the next error:

Cannot derive parameters for the stored procedure dbo.CreateUser. Have you loaded the provider that supports SqlCommand?

   at Insight.Database.Providers.InsightDbProvider.DeriveParametersFromStoredProcedure(IDbCommand command)

Reason: Our customers are asking to enable the Always Encrypted feature, which was not available to .NET Core until now.

Environment: ASP.NET Core 3.1 on Windows 10

Jaxelr commented 4 years ago

I am guessing the correct implementation of this will be using a Provider akin to the Insight.Database.Providers. that currently exist on the repository. Since Microsoft.Data.SqlClient targets netstandard 2.0 that would mean that usage on 4.5. would be out.

I did manage to replace on the default provider and at least in my initial tests it did worked.

jonwagner commented 4 years ago

Yup - my expectation is that we just duplicate the provider code and swap out the namespace.

Jaxelr commented 4 years ago

Ill take a stab during the weekend.