甲骨文ODP.Net随着实体框架6 - 实体框架数据库兼容的提供者无法找到 [英] Oracle ODP.Net With Entity Framework 6 - Entity framework database compatible provider could not be found

查看:573
本文介绍了甲骨文ODP.Net随着实体框架6 - 实体框架数据库兼容的提供者无法找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图建立与实体框架6上的Oracle数据库的作品,想使用ODAC 12c的第3版,其中包括对实体框架6 code首先和code首先迁移的支持,一个MVC 5 Web应用程序;的NuGet,.NET框架4.5.2;和ODP.NET,管理驱动XML DB。按

I am trying to build an MVC 5 Web application with Entity Framework 6 that works on Oracle Database , am trying to use 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

<一个href="http://www.oracle.com/technetwork/topics/dotnet/whatsnew/index.html">http://www.oracle.com/technetwork/topics/dotnet/whatsnew/index.html

我有VS 2013社区版更新4。

I have VS 2013 Community Edition update 4 .

我试图用ADO.Net实体数据模型中添加模式,以$ C C首先$。

Am trying to add Model using ADO.Net Entity Data Model , With Code First.

我在Web.config中进行以下配置

I have the following configured in my Web.config

    <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.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />


  </configSections>

  <entityFramework>
    <contexts>
      <context type="Tamayz.Context.Default, Tamayz.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.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
    </providers>
  </entityFramework>

我还添加了Oracle.ManagedDataAccess版本4.121.2.0作参考,并重新生成解决方案。

I also added Oracle.ManagedDataAccess version 4.121.2.0 as a reference and rebuild the solution.

我想现在用ADO.Net实体数据模型中添加模式,以$ C C首先$。但我收到以下消息在向导的最后一个屏幕:

I tried now to add Model using ADO.Net Entity Data Model , With Code First. but am getting the following message in the last screen of the wizard:

您的项目引用该实体框架的最新版本;然而,实体框架的数据库提供与此版本兼容找不到您的连接...

Your project references that latest version of entity framework; however, an Entity Framework database Provider compatible with this version could not be found for your connection...

如何才能正确地配置我的应用程序能够使用ODAC与EF6 code第一?

How could I properly configure my application to be able to use ODAC with EF6 Code first ?

推荐答案

我终于能使用ODP与EF6。

I finally was able to to use ODP with EF6.

我做了以下,使其工作: -

I did the following to make it work :-

首先安装ODAC 12c的第3版,其中包括对C第一,code首先迁移实体框架6 $ C $的支持;的NuGet,.NET框架4.5.2;和ODP.NET,管理驱动XML DB。按

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

<一个href="http://www.oracle.com/technetwork/topics/dotnet/whatsnew/index.html">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.dll

Oracle.ManagedDataAccess.EntityFramework.dll

Oracle.ManagedDataAccess.EntityFramework.dll

安装使用的NuGet由包管理器控制台中运行以下命令EF6.1.1(您可以通过工具 - >的NuGet软件包管理器中输入 - >程序包管理器控制台):

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

和修改你的web.config或web.config中使用Oracle.ManagedDataAccess,通过增加供应商和一个有效的连接字符串,例如:

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>

重新编译为x86的应用程序,并开始使用EF6,你可以检查它的工作原理是将使用ADO.Net实体模型使用$ C C首先$模型

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

这篇关于甲骨文ODP.Net随着实体框架6 - 实体框架数据库兼容的提供者无法找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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