加入收藏 | 设为首页 | 会员中心 | 我要投稿 PHP编程网 - 黄冈站长网 (http://www.0713zz.com/)- 数据应用、建站、人体识别、智能机器人、语音技术!
当前位置: 首页 > 百科 > 正文

实体框架 – Oracle ODAC 12c第3版32位测试版支持EF 6.x?

发布时间:2021-01-08 05:02:25 所属栏目:百科 来源:网络整理
导读:我在Visual Studio 2013中安装了 Windows 8.1 64位.我安装了最新的Oracle ODAC 12c第3版32位测试版,声称支持EF 6.当我将ADO.NET实体框架添加到我的项目并选择我的Oracle时数据连接,它不允许我选择Entity Framework 6.0版本.它选择了Entity Framework 5.x,

我在Visual Studio 2013中安装了 Windows 8.1 64位.我安装了最新的Oracle ODAC 12c第3版32位测试版,声称支持EF 6.当我将ADO.NET实体框架添加到我的项目并选择我的Oracle时数据连接,它不允许我选择Entity Framework 6.0版本.它选择了Entity Framework 5.x,版本6.x显示为灰色.它表示“无法为您的数据连接找到与最新版本的实体框架兼容的实体框架数据库提供程序”.这是为什么?

解决方法

我做了以下工作以使其工作: –

首先安装ODAC 12c第3版,其中包括对实体框架6代码优先和代码优先迁移的支持; NuGet,.NET Framework 4.5.2;和ODP.NET,托管驱动程序XML DB.按照

http://www.oracle.com/technetwork/topics/dotnet/whatsnew/index.html

将两个引用添加到我的项目引用中,它们是:

Oracle.ManagedDataAccess.dll

Oracle.ManagedDataAccess.EntityFramework.dll

通过在程序包管理器控制台中运行以下命令,使用NuGet安装EF6.1.1(可以通过Tools-> NuGet程序包管理器 – >程序包管理器控制台输入):

Install-Package EntityFramework -Version 6.1.1

并修改您的web.config或web.config以使用Oracle.ManagedDataAccess,方法是添加Provider和有效的连接字符串,例如:

<configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,EntityFramework,Version=6.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <section name="Oracle.ManagedDataAccess.Client" type="OracleInternal.Common.ODPMSectionHandler,Oracle.ManagedDataAccess,Version=4.121.2.0,PublicKeyToken=89b483f429c47342" />
    <!-- For more information on Entity Framework configuration,visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
  </configSections>
  <entityFramework>
    <contexts>
      <context type="App.Context.Default,App.Context">
        <databaseInitializer type="MyProject.Context.Config.ContextInitializer,MyProject.Context" />
      </context>
    </contexts>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory,EntityFramework" />
    <providers>
      <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices,Oracle.ManagedDataAccess.EntityFramework,Version=6.121.2.0,PublicKeyToken=89b483f429c47342" />
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices,EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <connectionStrings>
    <add name="Default" providerName="Oracle.ManagedDataAccess.Client" connectionString="DATA SOURCE=XE;USER ID=User" />
  </connectionStrings>

将您的应用程序重建为x86,并开始使用EF6,您可以使用代码优先使用ADO.Net实体模型添加模型来检查它是否有效

(编辑:PHP编程网 - 黄冈站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读