EF 配置Oracle数据库

前端之家收集整理的这篇文章主要介绍了EF 配置Oracle数据库前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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


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



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


<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,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,PublicKeyToken=89b483f429c47342" />
    <providers>
      <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices,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,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好像没有用
原文链接:https://www.f2er.com/oracle/210304.html

猜你在找的Oracle相关文章