我们尝试在 Oracle 11g 和 ODP.NET 11.2.0.3.20 中使用 Entity Framework 模型优先方法。我们想将 EF 4.1 或 EF 5.0 与 DbContext
一起使用.
精简版:
有没有人设法做到这一点?
长版:
在 VS2010 和 Entity Framework 4.0 上,一切正常。我可以 Generate Database from Model
.
当我尝试使用 EF 4.1 或 EF 5.0 时,我总是得到一个 Object reference not set to an instance of an Object
Visual Studio 中的错误消息:
我尝试了以下方法:
Generate Oracle via T4 (TPT).xaml
和 SSDLToOracle.tt
)。然后我点击了 Generate Database from Model
并选择了一个有效的 Oracle 连接,但 Visual Studio 只显示该错误。 它仅在我使用 VS2010 和 EF 4.0 时才有效。
但是,Oracle 声称它应该可以工作,请参阅 http://www.oracle.com/technetwork/topics/dotnet/downloads/install112030-1440546.html :
ODAC supports DbContext APIs.
有没有人设法将 EF 4.1 或 5.0 与 Oracle ODP.NET 一起使用?
编辑:结果证明它在 32 位虚拟机上运行良好。问题仅出现在我的 64 位 Windows 7 机器上。
最佳答案
只需从项目配置文件中删除相应的连接字符串。然后选择new connection (to Oracle database),点击生成DDL。
关于oracle - ODP.NET 是否支持带有 DbContext 的 EF 模型优先?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18358853/