【发布时间】:2015-04-09 18:22:25
【问题描述】:
我在 Windows 7-x64 上使用 Visual Studio 2013 Professional 和 .Net 4.5。我安装了 Firebird 2.5.4-x64。
我知道其他人可以将 Firebird 与 Entity Framework 6 一起使用,并且通过阅读大量博客和 stackoverflow 帖子,我自己发现了几个问题。但我已经尝试了我能想到的一切,我完全被困住了。在我完全放弃使用 Firebird 之前,我想,我会看看是否有人可以帮助我找出我做错了什么。
似乎有很多关于如何在 Visual Studio 中配置 firebird 的过时信息,我已经尝试了很多变体,但这是我认为正确的过程:
- 我安装了 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 文件进行了更新。 (除了尝试下面的默认 App.config 文件,我还尝试使用像 the one in this blog 这样的文件)
<?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> 项目搭建成功
- 我成功添加了一个连接到现有 Firebird 数据库(Firedbird 数据提供程序和数据源显示在选项中)
- 我尝试添加一个新的
ADO.Net Entity Data Model,使用EF Designer from database选项和我刚刚添加的数据连接 -
当我点击
Next时出现此错误: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 包,则会启用 EF 5.0 选项,并且在使用 5.0 时不会出现此错误。 (但我真的很想改用 6.x!)
有谁知道我该如何克服这个错误?还有什么我可以查看或尝试解决的问题吗?感谢您的帮助!
【问题讨论】:
标签: entity-framework-6 firebird