2015-04-07 45 views
3

我在Windows 7-x64上使用Visual Studio 2013 Professional和.Net 4.5。我安裝了Firebird 2.5.4-x64。Visual Studio 2013中的實體框架6/Firebird數據庫提供程序兼容性問題教授

我知道其他人可以使用Firebird與實體框架6,我通過閱讀大量的博客和stackoverflow文章瞭解了我自己的幾個問題。但我已經嘗試過所有我能想到的事情,而且我完全陷入困境。我想,在我完全放棄使用Firebird之前,我會看到有人能幫我弄清楚我做錯了什麼。

似乎有很多關於如何在Visual Studio中配置火鳥過時的信息,我嘗試了很多很多的變化,但這裏是我的想法是正確的過程:

  • 我安裝了FirebirdSql.Data.FirebirdClient-4.6.1.0.msi。
  • 我驗證它更新GAC:

    The Global Assembly Cache contains the following assemblies: 
    FirebirdSql.Data.FirebirdClient, Version=4.6.1.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c, processorArchitecture=MSIL 
    Number of items = 1 
    
  • 我驗證了它的machine.config文件更新:

    <system.data> 
        <DbProviderFactories> 
        <add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/> 
        <add name="FirebirdClient Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".NET Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=4.6.1.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c"/> 
        </DbProviderFactories> 
    </system.data> 
    
  • 我安裝DDEXProvider-3.0.1.0.msi

  • 我驗證了這些條目已添加到註冊表中,並且路徑正確
  • 我創建了一個新Class Library項目
  • 我安裝了以下的NuGet包:

    <package id="EntityFramework" version="6.1.3" targetFramework="net45" /> 
        <package id="EntityFramework.Firebird" version="4.6.1.0" targetFramework="net45" /> 
        <package id="FirebirdSql.Data.FirebirdClient" version="4.6.1.0" targetFramework="net45" /> 
    
  • 我驗證的更新到App.config文件製作。

    <?xml version="1.0" encoding="utf-8"?> 
        <configuration> 
        <configSections> 
         <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> 
        </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> 
    </configuration> 
    
  • 我成功地構建了項目

  • 我成功添加一個連接到現有的火鳥分貝(除了嘗試一下默認值App.config文件,我使用一個像the one in this blog也試過)(該Firedbird數據提供程序和數據源顯示了在選項)
  • 我試圖阿迪新ADO.Net Entity Data Model,使用EF Designer from database選項和數據連接我剛剛加入
  • 當我點擊Next我得到這個呃ROR:

    Your project references the latest version of Entity Framework; however, 
    an Entity Framework database provider compatible with this version could 
    not be found for your data connection. If you have already installed a 
    compatible provider, ensure you have rebuilt your project before 
    performing this action. Otherwise, exit this wizard, install a compatible 
    provider, and rebuild your project before performing this action. 
    

如果我不安裝的EntityFramework NuGet包,還有是激活了,當我使用5.0我沒有得到這個錯誤EF 5.0選項。 (但我真的想用6.x代替!)

有沒有人有任何想法我可以通過這個錯誤?還有什麼我可以看看或做的嘗試弄清楚嗎?謝謝你的幫助!

回答

0

哇!我終於明白髮生了什麼事。我使用Manage NuGet Packages...來安裝軟件包,它看起來像安裝沒有問題的一切。我正在關注另一個教程,它讓我使用軟件包管理器控制檯&由於我的項目位於網絡共享位置,因此出現錯誤。所以,我想知道是否火鳥的東西有類似的問題。

果然,當我在控制檯中運行install-package entityframework.firebird時,我看到錯誤!這將解釋爲什麼我的app.config文件沒有得到更新。現在,an Entity Framework database provider compatible with this version could not be found消息是有意義的。 Manage NuGet Packages...太糟糕了,出現錯誤時不會彈出錯誤消息!那會爲我節省很多時間。

1

您錯過了提供者註冊的配置中的entityFramework部分。當您安裝EntityFramework.Firebird時,應該添加設置。

<entityFramework> 
    <defaultConnectionFactory type="FirebirdSql.Data.EntityFramework6.FbConnectionFactory, EntityFramework.Firebird" /> 
    <providers> 
     <provider invariantName="FirebirdSql.Data.FirebirdClient" type="FirebirdSql.Data.EntityFramework6.FbProviderServices, EntityFramework.Firebird" /> 
     <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> 
    </providers> 
</entityFramework> 

你可以看到整個App.confighere

此外repository可能會給你一個開始,雖然它只是基本上安裝NuGet包的結果。更多詳情here

+0

感謝您花時間嘗試幫助@ cincura.net。我覺得在安裝nuget軟件包之後很奇怪,App.config似乎漏掉了一些東西。這就是爲什麼我在我的問題中提到我也嘗試過其他配置文件(實際上它是由您引用的同一個人)。希望有一些與我之前嘗試過的有所不同的東西,我將你鏈接的那個複製/粘貼到我的項目中,但它沒有任何作用。 –

相關問題