Using Oracle with EF code first

北战南征 提交于 2020-01-14 03:04:28

问题


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 or ODAC?
  • Could I use ODAC 12c or any other versions for Oracle 10g or each Oracle version has its own ODAC 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!