C# 将Firebird网络提供程序集成到应用程序中
在我的项目中,我使用EntityFramework6连接到Firebird,并使用嵌入式服务器类型。在安装了Firebird Net Provider的计算机上,我的应用程序工作正常,但在没有安装Firebird Net Provider的计算机上,我的应用程序崩溃并出现错误: 具有固定名称“FirebirdSql.Data.FirebirdClient”的ADO.NET提供程序未在计算机或应用程序配置文件中注册 如何在配置文件中注册ADO.NET提供程序以避免此错误?这是我的app.config:C# 将Firebird网络提供程序集成到应用程序中,c#,wpf,ado.net,firebird,C#,Wpf,Ado.net,Firebird,在我的项目中,我使用EntityFramework6连接到Firebird,并使用嵌入式服务器类型。在安装了Firebird Net Provider的计算机上,我的应用程序工作正常,但在没有安装Firebird Net Provider的计算机上,我的应用程序崩溃并出现错误: 具有固定名称“FirebirdSql.Data.FirebirdClient”的ADO.NET提供程序未在计算机或应用程序配置文件中注册 如何在配置文件中注册ADO.NET提供程序以避免此错误?这是我的app.confi
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="ScheduleWorkbench.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<entityFramework>
<defaultConnectionFactory type="FirebirdSql.Data.EntityFramework6.FbConnectionFactory, EntityFramework.Firebird" />
<providers>
<provider invariantName="FirebirdSql.Data.FirebirdClient" type="FirebirdSql.Data.EntityFramework6.FbProviderServices, EntityFramework.Firebird" />
</providers>
</entityFramework>
<connectionStrings>
<add name="DbModel" connectionString="character set=UTF8;data source=localhost;initial catalog=H:\Projects\ScheduleWorkbench\ScheduleWorkbench\Firebird\SCHEDULE.FDB;user id=SYSDBA;password=masterkey;role=SYSDBA;server type=1;client library=H:\Projects\ScheduleWorkbench\ScheduleWorkbench\Firebird\fbclient.dll" providerName="FirebirdSql.Data.FirebirdClient" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Syncfusion.Shared.Wpf" publicKeyToken="3d67ed1f87d44c89" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-15.2451.0.40" newVersion="15.2451.0.40" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
将此添加到您的
[app | web |机器].config
:
<system.data>
<DbProviderFactories>
<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>
现在,即使在安装了提供商的计算机上,也会出现此错误。尽管FirebirdSql.Data.FirebirdClient.dll位于应用程序所在的文件夹中