EF 配置Oracle数据库的具体操作方法

网络编程 2021-07-05 16:08www.168986.cn编程入门
狼蚁网站SEO优化长沙网络推广就为大家带来一篇EF 配置Oracle数据库的具体操作方法。长沙网络推广觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随长沙网络推广过来看看吧

EF可以配置Oracle数据库,但不知道为什么一直配置不好。

其实可以使用使用NUGET管理程序包,自动配置数据库,但需要注意的时,需要安装两个包,而并不是一个,我一直以为时一个,但已启动程序就会出错。


安装后配置文件的主要的改变如下

 <configSections>
  <!-- For more information on Entity Framework configuration, visit http://go.microsoft./fwlink/?LinkID=237468 -->
  <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.manageddataaess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
 </configSections>
 <connectionStrings>
  <add name="DefaultConnection" providerName="Oracle.ManagedDataAess.Client" connectionString="Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.19.19.187)(PORT=6521))(CONNECT_DATA=(SERVICE_NAME=easa)));User ID=User;Password=Password;" /> 
 </connectionStrings>

<entityFramework>
  <defaultConnectionFactory type="Oracle.ManagedDataAess.EntityFramework.OracleConnectionFactory, Oracle.ManagedDataAess.EntityFramework, Version=6.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
  <providers>
   <provider invariantName="Oracle.ManagedDataAess.Client" type="Oracle.ManagedDataAess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAess.EntityFramework, Version=6.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
  </providers>
 </entityFramework>
 <system.data>
  <DbProviderFactories>
   <remove invariant="Oracle.ManagedDataAess.Client" />
   <add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAess.Client.OracleClientFactory, Oracle.ManagedDataAess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
  </DbProviderFactories>
 </system.data>
 <oracle.manageddataaess.client>
  <version number="">
   <dataSources>
    <dataSource alias="SampleDataSource" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.19.19.187)(PORT=6521))(CONNECT_DATA=(SERVICE_NAME=easa))) " />
   </dataSources>
  </version>
 </oracle.manageddataaess.client>

 oracle.manageddataaess.client配置节的dataSource好像没有用

以上这篇EF 配置Oracle数据库的具体操作方法就是长沙网络推广分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持狼蚁SEO。

Copyright © 2016-2025 www.168986.cn 狼蚁网络 版权所有 Power by