Oracle ODP.Net与实体框架6 – 实体框架数据库兼容提供程序无法
我正在尝试使用适用于Oracle数据库的实体框架6构建一个MVC 5 Web应用程序,我试图使用ODAC 12c第3版,其中包括对实体框架6代码优先和代码优先迁移的支持; NuGet,.NET Framework 4.5.2;和ODP.NET,托管驱动程序XML DB。按照
http://www.oracle.com/technetwork/topics/dotnet/whatsnew/index.html 我有VS 2013社区版更新4。 我试图添加使用ADO.Net实体数据模型,代码优先的模型。 我在我的Web.config中配置了以下配置 <configSections> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,EntityFramework,Version=6.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089" requirePermission="false" /> <section name="Oracle.ManagedDataAccess.Client" type="OracleInternal.Common.ODPMSectionHandler,Oracle.ManagedDataAccess,Version=4.121.1.0,PublicKeyToken=89b483f429c47342" /> </configSections> <entityFramework> <contexts> <context type="Tamayz.Context.Default,Tamayz.Context"> <databaseInitializer type="MyProject.Context.Config.ContextInitializer,MyProject.Context" /> </context> </contexts> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory,EntityFramework" /> <providers> <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices,Oracle.ManagedDataAccess.EntityFramework,Version=6.121.1.0,PublicKeyToken=89b483f429c47342" /> </providers> </entityFramework> 我还添加了Oracle.ManagedDataAccess版本4.121.2.0作为参考,并重新构建了解决方案。 我现在尝试使用ADO.Net实体数据模型添加模型,使用代码优先。但在向导的最后一个屏幕中收到以下消息: 您的项目引用最新版本的实体框架;但是,与您的连接无法找到与此版本兼容的实体框架数据库提供者… 如何正确配置我的应用程序能够使用ODAC与EF6代码? 我终于能够用EF6使用ODP。我做了以下工作: 首先安装ODAC 12c第3版,其中包括对实体框架6的代码优先和代码优先迁移的支持; NuGet,.NET Framework 4.5.2;和ODP.NET,托管驱动程序XML DB。按照 http://www.oracle.com/technetwork/topics/dotnet/whatsnew/index.html 添加两个引用到我的项目引用,它们是: Oracle.ManagedDataAccess.dll Oracle.ManagedDataAccess.EntityFramework.dll 通过在Package Manager Console中运行以下命令,可以使用NuGet安装EF6.1.1(您可以通过Tools-> NuGet Package Manager – > Package Manager Console输入): Install-Package EntityFramework -Version 6.1.1 并修改您的web.config或web.config以使用Oracle.ManagedDataAccess,通过添加提供程序和有效的连接字符串,例如: <configSections> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,PublicKeyToken=b77a5c561934e089" requirePermission="false" /> <section name="Oracle.ManagedDataAccess.Client" type="OracleInternal.Common.ODPMSectionHandler,Version=4.121.2.0,PublicKeyToken=89b483f429c47342" /> <!-- For more information on Entity Framework configuration,visit http://go.microsoft.com/fwlink/?LinkID=237468 --> </configSections> <entityFramework> <contexts> <context type="App.Context.Default,App.Context"> <databaseInitializer type="MyProject.Context.Config.ContextInitializer,EntityFramework" /> <providers> <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices,Version=6.121.2.0,PublicKeyToken=89b483f429c47342" /> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices,EntityFramework.SqlServer" /> </providers> </entityFramework> <connectionStrings> <add name="Default" providerName="Oracle.ManagedDataAccess.Client" connectionString="DATA SOURCE=XE;USER ID=User" /> </connectionStrings> 将您的应用程序重新构建为x86,并开始使用EF6,您可以使用代码优先使用ADO.Net实体模型添加模型来检查它是否正常工作 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- Linux下Redis的安装和部署
- ruby-on-rails – Rails更短“time_ago_in_words”
- azure – 使用Service Fabric改进CD Pipeline
- c# – 如何在Application Start上更改Entity Framework 5中
- c – 删除使用new创建的2D或3D指针
- xml – 无法使EclipseLink MOXy工作
- Atom编辑器折腾记_(23)加快React开发的插件汇总【浪一波】
- Flex4+BlazeDS+Spring+Hibernate 整合(附源码)
- C# 网络编程之简易聊天示例
- ruby-on-rails – Rails Bug?除非父母修改(嵌套形式),否则