簡體   English   中英

將Firebird Net提供程序集成到應用程序中

[英]Integration of the Firebird Net provider into the application

在我的項目中,我使用Entity Framework 6通過嵌入式服務器類型連接到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|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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM