-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The requested .Net Framework Data Provider's implementation does not have an Instance field of a System.Data.Common.DbProviderFactory derived type. #98
Comments
A small console app that demonstrates the issue - maybe you need Code based configuration as well (dispite the docs saying something else) - I have not done a lot of .NET Framwork testing. |
@ErikEJ, what should be my defaultConnectionFactory? I have the following in my app config. |
That looks wrong. I dont think my readme mentions that you should have that in your app.config. But I cannot help you based on fragments of code, please share a runnable simple app that exhibits the issue. |
This sample should demonstrate app.config based use with .NET Framework https://github.com/ErikEJ/EntityFramework6PowerTools/tree/community/test%2FSmokeTestNetFx |
Thanks, @ErikEJ. I had to register the provider in the code, and I see the app is now connecting. Please consider this issue closed. |
@ShahidRasheed There was missing parts in the app.config configuration, you need to add this as well, then pure app.config based configuration will work: <system.data>
<DbProviderFactories>
<add name="SqlClient Data Provider"
invariant="Microsoft.Data.SqlClient"
description=".NET Framework Data Provider for SqlServer"
type="Microsoft.Data.SqlClient.SqlClientFactory, Microsoft.Data.SqlClient" />
</DbProviderFactories>
</system.data>
|
@ErikEJ thanks, on comparison I see the type is different in my config. I will update the config and remove the code updates. Will send an update once done. |
@ShahidRasheed all required config is documented in the readme. |
Hi Erik,
I am updating our NuGet libraries to use Microsoft.Data.SqlClient. Libraries use .Net framework 4.7.2, and I have installed Microsoft.Data.SqlClient, along with your package.
I am running into the following exception:
System.InvalidOperationException: The requested .Net Framework Data Provider's implementation does not have an Instance field of a System.Data.Common.DbProviderFactory derived type.
I have updated the config sections as per your suggestions:
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<entityFramework> <providers> <provider invariantName="Microsoft.Data.SqlClient" type="System.Data.Entity.SqlServer.MicrosoftSqlProviderServices, ErikEJ.EntityFramework.SqlServer" /> </providers> </entityFramework>
<system.data> <DbProviderFactories> <add name="SqlClient Data Provider" invariant="Microsoft.Data.SqlClient" description=".Net Framework Data Provider for SqlServer" type="System.Data.Entity.SqlServer.MicrosoftSqlProviderServices, ErikEJ.EntityFramework.SqlServer" /> </DbProviderFactories> </system.data>
My connection string has also been updated, and I am using Active Directory Managed Identity authentication; the following is a sample connection string.
<add name="ConStName" connectionString="Data Source={AzureManagedInstance};Initial Catalog={MyDB};Persist Security Info=True;Authentication=Active Directory Managed Identity;MultipleActiveResultSets=True" providerName="Microsoft.Data.SqlClient" />
Please let me know if you need any other details.
The text was updated successfully, but these errors were encountered: