Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将Firebird网络提供程序集成到应用程序中_C#_Wpf_Ado.net_Firebird - Fatal编程技术网

C# 将Firebird网络提供程序集成到应用程序中

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

在我的项目中,我使用EntityFramework6连接到Firebird,并使用嵌入式服务器类型。在安装了Firebird Net Provider的计算机上,我的应用程序工作正常,但在没有安装Firebird Net Provider的计算机上,我的应用程序崩溃并出现错误:

具有固定名称“FirebirdSql.Data.FirebirdClient”的ADO.NET提供程序未在计算机或应用程序配置文件中注册

如何在配置文件中注册ADO.NET提供程序以避免此错误?这是我的app.config:

  <?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位于应用程序所在的文件夹中