问题
I wrote a project with EF code first 6
and SQL Server 2008R2
for a company, Now the company wants to switch its DB to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
,
- How could I find appropriate version of
ODP.NET
orODAC
? - Could I use
ODAC 12c
or any other versions forOracle 10g
or eachOracle
version has its ownODAC
version?
回答1:
You could just rely on the last version of odp.net managed driver but beware that some features might not be available on your 10g (like APPLY)
Changes in Oracle Data Provider for .NET Release 12.1 in ODAC 12c Release 2 Support for APPLY Keyword Language Integrated Query (LINQ) is a .NET querying language. At runtime, LINQ is translated into native database SQL before it can query the database. In some circumstances, LINQ uses the non-standard APPLY keyword in its SQL translation for retrieving lateral views. Oracle Database and ODP.NET support the APPLY keyword in Oracle Database 12c Release 1 (12.1) to more fully support LINQ
On the other hand oracle has no official support for EF code first (link) and moreover odp.net is not compatible with EF6 so you'll have to target EF5 for now (link)
At the end of the day you'll need to rely on either of the two
- Entity Framework 5 and Odp.Net (free but without official support for code first)
- Entity Framework 6 and Devart dot connect (payed but full code first support)
As far as I am concerned I've successfully implemented solutions based on a scenario as the one bellow
- Oracle database (11g)
- Odp.net managed driver via nuget (121.1.1)
- Odac client installation is not required
- Entity Framework 5
来源:https://stackoverflow.com/questions/23718538/using-oracle-with-ef-code-first