首先使用Oracle与EF代码 [英] Using Oracle with EF code first
问题描述
我为一家公司写了一个有 EF代码的项目6
和 SQL Server 2008R2
将其数据库切换到 Oracle数据库10g企业版10.2.0.1.0版
,
- 我如何找到适当版本的
ODP.NET
或ODAC
? - 我可以使用
ODAC 12c
或任何其他版本的Oracle 10g
每个Oracle
版本都有自己的ODAC
版本?
p>
支持的Oracle Data Provider for .NET Release 12.1中的更改for APPLY关键字
语言集成查询(LINQ)是一种.NET查询语言。在运行时,LINQ在它可以查询数据库之前被转换为本地数据库SQL。在某些情况下,LINQ在其SQL翻译中使用非标准APPLY关键字来检索横向视图。 Oracle数据库和ODP.NET支持Oracle Database 12c第1版(12.1)中的APPLY关键字,以更充分地支持LINQ
官方支持EF代码(链接)
,此外odp.net不兼容与EF6,因此您必须立即指定EF5(连结)
在一天结束时,您需要依赖于两个
- 实体框架5和Odp.Net(免费,但没有官方支持代码)
- Entity Framework 6和Devart dot connect(已支付但全部代码优先支持)
就我而言,我已经成功地实现了基于一个场景的解决方案。
- Oracle数据库(11g)
- Odp.net托管驱动程序通过nuget(121.1.1)
- 必需
- Entity Framework 5
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?
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
这篇关于首先使用Oracle与EF代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!