oracle - ODP.NET 是否支持带有 DbContext 的 EF 模型优先?

标签 oracle entity-framework odp.net ef-model-first odac

我们尝试在 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 中的错误消息:

enter image description here

我尝试了以下方法:

  • 在 VS2012 中创建了一个新的 EF 5.0 模型,将代码生成工作流和模板设置为 Oracle 的东西( Generate Oracle via T4 (TPT).xamlSSDLToOracle.tt )。然后我点击了 Generate Database from Model并选择了一个有效的 Oracle 连接,但 Visual Studio 只显示该错误。
  • 在VS2012中创建了EF 4.1模型,同样的错误。
  • 在VS2010中创建了EF 4.1模型,同样的错误。
  • 在 EF 5.0 和 EF 4.1 中尝试了数据库优先方法,同样的错误。

  • 它仅在我使用 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/

    相关文章:

    oracle - 从Oracle压缩数据到配置单元错误

    oracle - Golang godror - 执行一个 PL/SQL 游标

    c# - 为什么这个 oracle 批量插入不起作用?

    c# - 模拟 Entity Framework 给我对象引用未设置为对象的实例

    c# - Oracle AQ 主题队列使用 ODP.NET 出队

    oracle - 使用 FOR UPDATE SKIP LOCKED 打开 OUT SYS_REFCURSOR 时出错

    java - 将参数从 Java 传递给 Sql

    python - cx_Oracle : how do I get the ORA-xxxxx error number?

    c# - 消除 LET 运算符和 SqlFunctions

    c# - 如何使用 EF+Web API 处理深层对象?