I am getting the error above on a .netCore API project that's referencing .netCore library that connects to a SQL database. Can anyone help me here? I have already referenced the System.Data.SQLClient or Microsoft.Data.SqlClient and still no luck.
Thanks,
Herbert
There is no global configuration (commonly known as GAC) in .NET Core. As a result, the provider is not registered by default. You will have to manually register the provider. You can register it as
DbProviderFactories.RegisterFactory("System.Data.SqlClient", System.Data.SqlClient.SqlClientFactory.Instance);
//for Connection
var factory = DbProviderFactories.GetFactory("System.Data.SqlClient");
DbConnection connection = factory.CreateConnection();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With