【问题标题】:Integration of the Firebird Net provider into the application将 Firebird Net 提供程序集成到应用程序中
【发布时间】:2018-05-29 11:50:07
【问题描述】:

在我的项目中,我使用 Entity Framework 6 连接到带有嵌入式服务器的 Firebird。在安装了 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>

【问题讨论】:

    标签: c# wpf ado.net firebird


    【解决方案1】:

    将此添加到您的[app|web|machine].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 位于应用程序所在的文件夹中
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-30
    • 2021-03-04
    相关资源
    最近更新 更多