【发布时间】:2015-03-12 05:03:01
【问题描述】:
我无法在 Visual Studio 2013 .NET 4.0 上使用我的 Oracle DB 使用 EF。
这就是我所做的:
- 安装了 ODTwithODAC121012(我之前也安装过 ODAC1120320_x64)
- 成功建立新连接
- 从我的数据库成功生成了一个 edmx(我选择了 EF5)
这是我的 app.config :
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="Entities" connectionString="metadata=res://*/Entity.PVModel.csdl|res://*/Entity.PVModel.ssdl|res://*/Entity.PVModel.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string="data source=BWKBX;password=BWKBX;persist security info=True;user id=BWKBX"" providerName="System.Data.EntityClient" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
在我的代码中,当我可以实例化我的 DbContext 但我无法运行如下查询时:
db.MY_TABLE_SET.Where(p => p.FOO == "FOO").ToList();
这是我得到的错误:
System.ArgumentException was unhandled by user code
HResult=-2147024809
Message=Soit le fournisseur de magasins spécifié est introuvable dans la configuration, soit il n'est pas valide.
Source=System.Data.Entity
StackTrace:
à System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
à System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
à System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings appConfigConnection)
à System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, AppConfig config)
à System.Data.Entity.Internal.LazyInternalConnection.Initialize()
à System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel()
à System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
à System.Data.Entity.Internal.InternalContext.Initialize()
à System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
à System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
à System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
à System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
à System.Linq.Queryable.Where[TSource](IQueryable`1 source, Expression`1 predicate)
à OBS.SCAV.AdminKpiBox.Tests.TestVisualizeService.TestOneEnd() dans d:\Workspace\SCAV\G1R1 (DEV)\Web Service\AdminKpiBox\OBS.SCAV.AdminKpiBox.Tests\TestPeriodValidation.cs:ligne 30
InnerException: System.ArgumentException
HResult=-2147024809
Message=Le fournisseur de données .Net Framework demandé est introuvable. Il n'est peut-être pas installé.
Source=System.Data.Entity
StackTrace:
à System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
InnerException:
提前谢谢你。
【问题讨论】:
标签: c# entity-framework odp.net