在.net 4.0中将Entity Framework与Oracle数据库一起使用-可能吗? [英] Use Entity Framework in .net 4.0 with Oracle database - possible?

查看:214
本文介绍了在.net 4.0中将Entity Framework与Oracle数据库一起使用-可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个针对.Net 4.0的应用程序(目前不能更高).我需要访问Oracle Db(11g),并且想使用实体框架.

I am building an application that targets .Net 4.0 (cannot be higher for the moment). I need to get access to Oracle Db (11g) and I wanted to use Entity Framework.

要做到这一点,我知道我必须使用:

To be able to do that I know that I have to use:

  • Oracle.ManagedDataAccess
  • Oracle.ManagedDataAccess.EntityFramework

第一个没有问题,但是当我尝试安装Oracle.ManagedDataAccess.EntityFramework NuGet软件包时,出现以下消息:

The first one is no problem, however when I try to install the Oracle.ManagedDataAccess.EntityFramework NuGet package, I get the following message:

无法安装软件包'Oracle.ManagedDataAccess.EntityFramework 12.1.2400'.您正在尝试将此软件包安装到以'.NETFramework,Version = v4.0'为目标的项目中,但该软件包不包含 与该程序集兼容的任何程序集引用或内容文件 框架.有关更多信息,请与程序包作者联系.

Could not install package 'Oracle.ManagedDataAccess.EntityFramework 12.1.2400'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

当我将目标框架更改为4.5.2时,该软件包会安装并且一切正常,因此我假设此软件包某种程度上依赖于.Net framework〜4.5.

When I change target framework to 4.5.2 the package installs and everything works fine so I am assuming that this package is somehow dependent on .Net framework ~4.5.

是否有任何变通办法使其可以与.Net 4.0一起使用?

Is there any workaround to make it work with .Net 4.0?

请明确说明,我已安装Entity Framework 6.1.3,因为这是安装Oracle EF提供程序的先决条件

Just to be clear, I have instaled Entity Framework 6.1.3 as this is prerequisite for installing Oracle's EF provider

推荐答案

我遇到了同样的问题,发现Oracle.ManagedDataAccess.EntityFramework 12.2.1100它是为.net 4.5构建的.

I had the same problem, and found that Oracle.ManagedDataAccess.EntityFramework 12.2.1100 it was built for .net 4.5.

组装浏览器屏幕截图

所以,我相信我们不能在.net 4.0中使用Oracle.ManagedDataAccess.EntityFramework 12.2.1100.

So, I believe that we can not use Oracle.ManagedDataAccess.EntityFramework 12.2.1100 with .net 4.0.

upd: 我从Oracle .NET团队收到了有关这种情况的解释:

upd: I received the explanation of that situation from Oracle .NET Team:

来自:"Oracle .NET团队"

From: "Oracle .NET Team"

日期:2017年6月16日,0:58:31

Date: 16 августа 2017 г., 0:58:31

主题:回复:[NuGet Gallery]软件包"Oracle.ManagedDataAccess.EntityFramework"所有者的消息

您好,Yuriy,

Microsoft不支持 .NET Framework 4对版本的支持4.5.1和 (截至2016年1月).在最新的ODP.NET版本中,Oracle 遵循该支持政策.

Microsoft desupported .NET Framework 4 support for versions 4.5.1 and earlier as of January, 2016. In the newest ODP.NET release, Oracle follows that support policy.

Oracle并未更改ODP.NET,以至于 它仅适用于.NET 4.5.2和更高版本.微软没有 更改.NET以防止向后兼容.其实是 新的ODP.NET可能与较旧的.NET 4可以正常工作 版本.我没有发现任何不兼容之处. Oracle只是不这样做 不再正式支持或认证较早的.NET版本.

Oracle did not change ODP.NET such that it only works in .NET 4.5.2 and newer versions. Microsoft did not change .NET that prevents backwards compatibility. It's actually likely that the new ODP.NET will work fine with the older .NET 4 versions. I'm not aware of any incompatibilities. Oracle just doesn't officially support nor certify the earlier .NET versions anymore.

关于Oracle .NET小组

Regards, Oracle .NET Team

这篇关于在.net 4.0中将Entity Framework与Oracle数据库一起使用-可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆