实体框架代码首先和Oracle ODAC 12c版本3错误 [英] Entity Framework Code First and Oracle ODAC 12c Release 3 Error

查看:275
本文介绍了实体框架代码首先和Oracle ODAC 12c版本3错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个这样的一个...



在实体框架和Oracle ...上设置代码第一个时,我收到以下错误...


没有找到具有
不变名称Oracle.ManagedDataAccess.Client的ADO.NET提供程序的实体框架提供程序。确保
提供程序已在
应用程序配置文件的'entityFramework'部分中注册。


以下设置...



实体框架6.1.1



ODAC 12c版本3



有关如何解决这个问题的任何想法?



我已经在下面添加了app.config文件...

 <?xml version =1.0encoding =utf-8?> 
< configuration>
< configSections>

< section name =entityFrameworktype =System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,EntityFramework,Version = 6.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089requirePermission =假/>
<! - 有关实体框架配置的更多信息,请访问http://go.microsoft.com/fwlink/?LinkID=237468 - >< / configSections>
< startup>
< supportedRuntime version =v4.0sku =。NETFramework,Version = v4.5/>
< / startup>
< connectionStrings>
< add name =ContextconnectionString =DATA SOURCE = ****; PASSWORD = ****; PERSIST SECURITY INFO = True; POOLING = False; USER ID = SYSTEMproviderName =Oracle。 ManagedDataAccess.Client/>
< / connectionStrings>
< entityFramework>
< defaultConnectionFactory type =System.Data.Entity.Infrastructure.LocalDbConnectionFactory,EntityFramework>
< parameters>
< parameter value =v11.0/>
< / parameters>
< / defaultConnectionFactory>
< providers>
< provider invariantName =System.Data.SqlClienttype =System.Data.Entity.SqlServer.SqlProviderServices,EntityFramework.SqlServer/>
< / providers>
< / entityFramework>
< / configuration>因为您使用了providerName Oracle,所以解决方案



解决方案

ManagedDataAccess.Client 在connectionString中。您需要在以下部分添加一行来定义它:

 < providers> 
< provider invariantName =Oracle.ManagedDataAccess.Clienttype =Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices,OracleManagedDataAccess.EntityFramework/>
< / providers>


A bit stumped with this one...

I'm receiving the following error when setting up Code First on Entity Framework and Oracle...

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.

With the following setup...

Entity Framework 6.1.1

ODAC 12c Release 3

Any ideas on how to fix this problem?

I've included the app.config file below...

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>

    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
   <connectionStrings>
    <add name="Context" connectionString="DATA SOURCE=****;PASSWORD=****;PERSIST SECURITY INFO=True;POOLING=False;USER ID=SYSTEM" providerName="Oracle.ManagedDataAccess.Client" />
  </connectionStrings> 
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>

解决方案

since you have used a providerName Oracle.ManagedDataAccess.Client in connectionString. you need to add a line in following section to define it:

<providers>  
<provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices,OracleManagedDataAccess.EntityFramework" />
</providers>

这篇关于实体框架代码首先和Oracle ODAC 12c版本3错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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