Oracle ODAC 12c第3版32位版本支持EF 6.x? [英] Oracle ODAC 12c Release 3 32-bit beta supports EF 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屋!