EF 配置Oracle数据库详解数据库

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

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

EF 配置Oracle数据库详解数据库

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

  <configSections> 
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/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.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" /> 
  </configSections> 
  <connectionStrings> 
    <add name="DefaultConnection" providerName="Oracle.ManagedDataAccess.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.ManagedDataAccess.EntityFramework.OracleConnectionFactory, Oracle.ManagedDataAccess.EntityFramework, Version=6.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" /> 
    <providers> 
      <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" /> 
    </providers> 
  </entityFramework> 
  <system.data> 
    <DbProviderFactories> 
      <remove invariant="Oracle.ManagedDataAccess.Client" /> 
      <add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" /> 
    </DbProviderFactories> 
  </system.data> 
  <oracle.manageddataaccess.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.manageddataaccess.client>

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

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/6687.html

(0)
上一篇 2021年7月17日
下一篇 2021年7月17日

相关推荐

发表回复

登录后才能评论