July 2014, wrote an article about EF5 with Visual Studio, Oracle 11g, the original address: http://www.cnblogs.com/HouZhiHouJueBlogs/p/ 3844028.html, Oracle is now supported to EF6. Technical update fast, some details such as not recorded, it is easy to be forgotten, so there is this blog post.
Some basic knowledge of. NET support from Oracle learn about
1. In the early days, Microsoft did its own System.Data.OracleClient. Now it has become an expired class. Performance and so on are not very good.
2.Oracle official out of the Odp.net Oracle.DataAccess.dll (unmanaged version) also divided into 32/64 bits. It is also troublesome to install a client environment when deploying. Very cumbersome.
3.Oracle official in recent years the new Oracle.ManagedDataAccess.dll this very force no longer distinguish 32/64 bits. And you don't need the client to install anything. Performance has also been improved. This version of the DLL is recommended for use with either ADO or other ORM frameworks . This time our EF6 will also be developed on the basis of this DLL.
The official is this must go official download the latest talent Support EF6 I am not supported from the lower version of NuGet:
Http://www.oracle.com/technetwork/database/windows/downloads/index-090165.html (the version that was downloaded was 4.121.2.0). After the download, the deployment is very simple, into the cmd window to execute INSTALLXX command, the following will prompt parameters.
Download good after from this directory Odp.net\managed\common take out Oracle.ManagedDataAccess.dll and Oracle.ManagedDataAccess.EntityFramework.dll, Ready for development use.
The use of Codefirst requires a related configuration, as follows:
<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"/> </configSections> <entityFramework> <defaultconnectionfactory type="Oracle.ManagedDataAccess.EntityFramework.OracleConnectionFactory,oracle.manageddataaccess.entityframework,version=6.121.2.0, Culture=Neutral,publickeytoken=89b483f429c47342"/><providers> <provider invariantname="Oracle.ManagedDataAccess.Client"Type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework , version=6.121.2.0, culture=neutral, publickeytoken=89b483f429c47342"/> </providers> </entityFramework> <system.data> <DbProviderFactories> <re Move invariant="Oracle.ManagedDataAccess.Client"/> <add name="odp.net, Managed Driver"Invariant="Oracle.ManagedDataAccess.Client"description="Oracle Data Provider for. NET, Managed Driver"type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.manageddataaccess, version=4.121.2.0, culture= Neutral, publickeytoken=89b483f429c47342"/> </DbProviderFactories> </system.data><connectionStrings> <add name="orastring"connectionstring="Data source= (DESCRIPTION =(ADDRESS = (PROTOCOL = TCP) (HOST = * * * * *) (PORT =1521)) (Connect_data=(SERVER=dedicated) (Service_Name=ORCL)) ); User ID=*****; password=*****; Persist Security Info=true"providername="Oracle.ManagedDataAccess.Client"/></connectionStrings>
Here's another note, because there are people and clients that have Oracle installed. This may cause some errors. Here, please check the C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config.
Under the Machine.config (64-bit word path is Framework64, preferably all detected)
Machine.config can be understood as the parent class of webconfig so we need to check if the contents are:
<section name="oracle.manageddataaccess.client " type= " OracleInternal.Common.ODPMSectionHandler, Oracle.manageddataaccess, version=4.121.1.0, Culture=neutral, publickeytoken=89b483f429c47342" />
Once the above configuration is complete, the EF6 can be put into use.
Reference Links:
Http://www.cnblogs.com/wlflovenet/p/4187455.html
Http://www.cnblogs.com/yzb305070/p/4251036.html
Issues with Oracle Access:
Http://docs.oracle.com/cd/E56485_01/win.121/e55744/toc.htm
Http://docs.oracle.com/cd/E56485_01/win.121/e55744/entityMigrate.htm#BABEHEFE
Entity Framework6 with Visual Studio update3 for Oracle 11g