简体   繁体   English

没有实例框架提供程序用于ADO.NET Oracle.ManagedDataAccess.Client没有配置

[英]No Entity Framework Provider for ADO.NET Oracle.ManagedDataAccess.Client Without Config

I'm getting the following error whenever I try to run this query: 每当我尝试运行此查询时,我收到以下错误:

var query = from u in StageEntity.STAGINGINTERACTIONPOINTS
  where u.OBJECTID == OBJECT_ID
  select u;

"Schema specified is not valid. Errors: \r\nStagingDB.ssdl(2,2) : error 0152: 
No Entity Framework provider found for the ADO.NET provider
with invariant name 'Oracle.ManagedDataAccess.Client'. 
Make sure the provider is registered in the 'entityFramework' 
section of the application config file. 
See http://go.microsoft.com/fwlink/?LinkId=260882 for more information."

However, the issue I believe is that I'm unable to access a config file in runtime. 但是,我认为问题是我无法在运行时访问配置文件。 This is because my application is an ArcObjects Extension and for some reason ignores all Config files that are not Config.esriaddinx. 这是因为我的应用程序是ArcObjects扩展,并且由于某种原因忽略了所有不是Config.esriaddinx的Config文件。 Therefore at run time, I get the connection string from the config file. 因此,在运行时,我从配置文件中获取连接字符串。

This works fine for SQL servers, but I have not tried this in Oracle before. 这适用于SQL服务器,但我之前没有在Oracle中尝试过这个。 I was wondering if there is something I need to include and declare at runtime for Oracle ODP to work. 我想知道是否需要包含并在运行时声明Oracle ODP才能工作。

Here's the connection string that I pull and call: 这是我拉和调用的连接字符串:

connection string="DATA SOURCE=(DESCRIPTION=(ADDRESS= (PROTOCOL=TCP) (HOST=examplehost.com)(PORT=1234))(CONNECT_DATA=(SID = sid)));PASSWORD=hunter2;PERSIST SECURITY INFO=True;USER ID=poor_username""

I then call this connection string whenever I declare an entity which I did making a partial class 每当我声明一个我做了部分类的实体时,我就会调用这个连接字符串

I have also looked at another stack question that had a similar issue, but I'm running the latest ODP.net (v 6.121) with Entity 6 which should be compatible. 我还看了另一个有类似问题的堆栈问题,但是我正在运行最新的ODP.net(v 6.121)和实体6,它应该是兼容的。

Also, the following fix: 另外,以下修复:

public partial class StagingEntities : DbContext
{
    private volatile Type _dependency;

    public StagingEntities(string connectionString)
        : base(connectionString)
    {
        _dependency = typeof(System.Data.Entity.SqlServer.SqlProviderServices);

    }
}

does not work. 不起作用。

Your solution: Please reinstall NuGet package for Oracle.ManagedDataAccess.Client- https://www.nuget.org/packages/Oracle.ManagedDataAccess.EntityFramework/ 您的解决方案:请重新安装NuGet包for Oracle.ManagedDataAccess.Client- https : //www.nuget.org/packages/Oracle.ManagedDataAccess.EntityFramework/

Extra information: I had the exact same issue, but for Oracle.DataAccess.Client. 额外信息:我有完全相同的问题,但对于Oracle.DataAccess.Client。 My issue said: " No Entity Framework provider found for the ADO.NET provider with invariant name 'Oracle.DataAccess.Client'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information. ". 我的问题是:“ 找不到具有不变名称'Oracle.DataAccess.Client'的ADO.NET提供程序的实体框架提供程序。确保提供程序已在应用程序配置文件的'entityFramework'部分中注册。请参阅http:// go.microsoft.com/fwlink/?LinkId=260882获取更多信息。

I had recently migrated from EF5 to EF6. 我最近从EF5迁移到EF6。 The old version of Oracle Managed ODP is not compatible with EF6. 旧版本的Oracle Managed ODP与EF6不兼容。 After installing Oracle.ManagedDataAccess.EntityFramework , I had to replace all occurrences of Oracle.DataAccess.Client in my project to Oracle.ManagedDataAccess.Client . 安装Oracle.ManagedDataAccess.EntityFramework后 ,我不得不将项目中出现的所有Oracle.DataAccess.Client替换为Oracle.ManagedDataAccess.Client It worked fine. 它工作正常。

I had this same problem couple of weeks back. 几个星期前,我遇到了同样的问题。 I am using Entity Framework 6.1.3 and ODP latest. 我正在使用Entity Framework 6.1.3和ODP最新版本。 I am using the entity framework in console library(.dll) and calling it from a WCF Service. 我在控制台库(.dll)中使用实体框架并从WCF服务中调用它。

The solution that worked for me was I have to install the nuget package for the entity framework and ODP provider in the WCF service too, as it refers for the ODP configuration only from the WCF web config. 对我有用的解决方案是我必须在WCF服务中为实体框架和ODP提供程序安装nuget包,因为它仅从WCF Web配置引用ODP配置。 (Weird, but I have to do that). (很奇怪,但我必须这样做)。

Also read somewhere that we have to do this only for console library projects. 还读到我们必须仅为控制台库项目执行此操作的地方。

Hope this might help you. 希望这可能对你有所帮助。

对我有用的是将App.config从我的.NET Framework EF项目复制到我的.NET Core MVC项目中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到具有不变名称“Oracle.ManagedDataAccess.Client”的ADO.NET提供程序的实体框架提供程序 - No Entity Framework provider found for the ADO.NET provider with invariant name 'Oracle.ManagedDataAccess.Client' ADO.NET提供程序“Oracle.ManagedDataAccess.Client”未在计算机或应用程序配置文件中注册,或者无法加载 - The ADO.NET provider 'Oracle.ManagedDataAccess.Client' is either not registered in the machine or application config file, or could not be loaded 如何在EF 6提供程序配置文件中添加/激活“ Oracle.ManagedDataAccess.Client”? - How to Add/Activate “Oracle.ManagedDataAccess.Client” in the EF 6 provider config file? 找不到ADO.NET提供程序的实体框架提供程序 - No Entity Framework provider found for the ADO.NET provider 未找到实体框架 ADO.NET Sql.Data.Client 提供程序 - Entity Framework ADO.NET Sql.Data.Client provider not found Oracle.ManagedDataAccess.Client支持ExecuteNonQuery() - Oracle.ManagedDataAccess.Client support ExecuteNonQuery() 通用实体框架项目“没有为ADO.NET提供者找到实体框架提供者” - Common Entity Framework Project “No Entity Framework provider found for the ADO.NET provider” 如何用 web.config 部分替换 machine.config 的“oracle.manageddataaccess.client”部分 - How to replace the “oracle.manageddataaccess.client” section of machine.config with web.config section 未找到具有不变名称'MySql.Data.MySqlClient'的ADO.NET提供程序的实体框架提供程序-WCF - No Entity Framework provider found for the ADO.NET provider with invariant name 'MySql.Data.MySqlClient' - WCF 没有为ADO.NET提供程序找到具有不变名称“System.Data.SqlClient”的实体框架提供程序。 - No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'.
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM