Oracle ODAC 12c第3版32位版本支持EF 6.x? [英] Oracle ODAC 12c Release 3 32-bit beta supports EF 6.x?

查看:124
本文介绍了Oracle ODAC 12c第3版32位版本支持EF 6.x?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Windows 8.1 64位与Visual Studio 2013我安装了最新的Oracle ODAC 12c版本3 32位测试版,声称支持EF 6.当我将ADO.NET实体框架添加到我的项目和选择我的Oracle数据连接,它不允许我选择Entity Framework 6.0版本。它选择了实体框架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



通过在Package Manager Console中运行以下命令,可以使用NuGet安装EF6.1.1(您可以通过Tools-> NuGet Package Manager - > Package Manager Console输入):

  Install-Package EntityFramework -Version 6.1.1 

并修改您的web.config或web.config以使用Oracle.ManagedDataAccess,通过添加提供程序和有效的连接字符串,例如:

 code>< configSections> 
< section name =entityFrameworktype =System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,EntityFramework,Version = 6.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089requirePermission =false/> ;
< section name =Oracle.ManagedDataAccess.Clienttype =OracleInternal.Common.ODPMSectionHandler,Oracle.ManagedDataAccess,Version = 4.121.2.0,Culture = neutral,PublicKeyToken = 89b483f429c47342/>
<! - 有关实体框架配置的更多信息,请访问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.Clienttype =Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices,Oracle.ManagedDataAccess.EntityFramework,Version = 6.121.2.0,Culture = neutral,PublicKeyToken = 89b483f429c47342/>
< provider invariantName =System.Data.SqlClienttype =System.Data.Entity.SqlServer.SqlProviderServices,EntityFramework.SqlServer/>
< / providers>
< / entityFramework>
< connectionStrings>
< add name =DefaultproviderName =Oracle.ManagedDataAccess.ClientconnectionString =DATA SOURCE = XE; USER ID = User/>
< / connectionStrings>

将您的应用程序重新构建为x86,并开始使用EF6,您可以通过添加模型来检查它是否工作使用ADO.Net实体模型使用Code First


I have Windows 8.1 64-bit with Visual Studio 2013. I've installed the latest Oracle ODAC 12c Release 3 32-bit beta which claims to supports EF 6. When I add the ADO.NET Entity Framework to my project and choose my Oracle data connection, it doesn't allow me to select the Entity Framework 6.0 version. It has Entity Framework 5.x selected and version 6.x is greyed out. It says 'An Entity Framework database provider compatible with the latest version of the Entity Framework could not be found for your data connection'. Why is that?

解决方案

I did the following to make it work :-

First Installing ODAC 12c Release 3 which includes support for Entity Framework 6 Code First and Code First Migrations; NuGet, .NET Framework 4.5.2; and ODP.NET, Managed Driver XML DB. As per

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

Adding two references , to my project references and they are :

Oracle.ManagedDataAccess.dll

Oracle.ManagedDataAccess.EntityFramework.dll

Installing EF6.1.1 using NuGet by running the following command in Package Manager Console( you can enter it by Tools->NuGet Package Manager -> Package Manager Console):

Install-Package EntityFramework -Version 6.1.1

And modify your web.config or web.config to use Oracle.ManagedDataAccess , by adding Provider and a valid connection string eg :

 <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, Culture=neutral, 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, Culture=neutral, 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>

Rebuild your Application as x86, and start using EF6 , you can check if it works by adding a model using ADO.Net Entity Model using Code First

这篇关于Oracle ODAC 12c第3版32位版本支持EF 6.x?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆