none
ODP.Net EF for VS 2017. Oracle connection throwing an error using EF ODP.Net RRS feed

  • Question

  • I am having issue with ODP.net Entity framework to connect to the Oracle databases in visual studio 2017. Getting following error when I try to connect to Oracle db using code first approach.

    I am using following packages

    <package id="EntityFramework" version="6.2.0" targetFramework="net462" />
      <package id="Oracle.ManagedDataAccess" version="12.1.24160719" targetFramework="net462" />
      <package id="Oracle.ManagedDataAccess.EntityFramework" version="12.1.2400" targetFramework="net462" />

    app.config:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <configSections>
        <section name="entityFramework"
          type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
          requirePermission="false"/>
        
      <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
      <section name="oracle.manageddataaccess.client"
          type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
      </configSections>
      <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
      </startup>
      <oracle.manageddataaccess.client>
        <version number="*">
          <dataSources>
            <dataSource alias="SampleDataSource" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL))) "/>
          </dataSources>
        </version>
      </oracle.manageddataaccess.client>
      <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
        <providers>
          <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
          <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>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <publisherPolicy apply="no"/>
            <assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral"/>
            <bindingRedirect oldVersion="0.0.0.0-4.121.2.0" newVersion="4.121.2.0"/>
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
      <connectionStrings>
        <add name="OracleDbContext" providerName="Oracle.ManagedDataAccess.Client"
          connectionString="User Id=oracle_user;Password=oracle_user_password;Data Source=oracle"/>
      </connectionStrings>
    </configuration>

    Thursday, June 7, 2018 3:50 PM

All replies

  • No one can help you when you don't post the exception message.
    Thursday, June 7, 2018 9:22 PM
  • Hi Siva,

    This forum discuss and ask questions related to the current versions of the ADO.NET Entity Framework and LINQ, since your issue is more related to odp.net, which is a 3rd-party component. I would suggest that you could post your issue on ODP.Net forum for suitable support.

    https://community.oracle.com/community/database/developer-tools/windows_and_.net/odp.net

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, June 8, 2018 1:50 AM