I am currently trying to port a .NET Framework application to .NET Core. We're using Firebird as a database. I updated the dependencies and most issues could be solved, but when compiling and starting the program I get the error:
Unable to determine the provider name for provider factory of type 'FirebirdSql.Data.FirebirdClient.FirebirdClientFactory'. Make sure that the ADO.NET provider is installed or registered in the application config.
The old app.config looked like this:
configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</configSections>
<system.data>
<DbProviderFactories>
<remove invariant="FirebirdSql.Data.FirebirdClient"/>
<add name="FirebirdClient Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".NET Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient"/>
</DbProviderFactories>
</system.data>
system.data is not available in .NET Core anymore and some of the dependencies have changed. So my new app.config looks like this:
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
<section name="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient"/>
</configSections>
<entityFramework>
<defaultConnectionFactory type="EntityFramework.Firebird.FbConnectionFactory, EntityFramework.Firebird" />
<providers>
<provider invariantName="FirebirdSql.Data.FirebirdClient" type="EntityFramework.Firebird.FbProviderServices, EntityFramework.Firebird"/>
</providers>
</entityFramework>
I've tried different things, I've read the documentation and I made sure that the dependencies EntityFramework.Firebird, EntityFrameworkCore.Firebird and Firebird.Sql.FirebirdClient are there, which contain the classes references in my app.config. I am really at a loss as to what is missing and I am sure it is something obvious. So mabye anymore here knows what I can do to provide the factory.
So the answer was that you cannot declare the DbProviderFactory in the app.config anymore. I found this in some StackOverflow question which I cannot find the link to anymore.
However, you can register it programmatically during the startup of your application:
In the app.config use:
with matching invariantName for the provider and key for the registration during Startup.
This setup worked for me.