none
Entity Framework 6 for Oracle Error RRS feed

  • Question

  • Hi, 

    I have created a model for EF 6.1.3 through nuget. I created a model based on a table on SQL server 2008 r2. I am able to do  Insert, update, delete operations to the table. Now  I want to use the model to connect to oracle "Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production" version.  I have followed the steps from the link http://www.codeproject.com/Articles/82017/Preparing-an-Entity-Framework-model-for-multi-prov. I have create an ssdl file for oracle with the following code

    <?xml version="1.0" encoding="utf-8" ?>

    <edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">  <!-- EF Runtime content -->  <edmx:Runtime>    <!-- SSDL content -->    <edmx:StorageModels>      <Schema Namespace="PersonalDetailsModel.Store" Alias="Self" Provider="Oracle.ManagedDataAccess.Client" ProviderManifestToken="Ora10g" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">        <EntityContainer Name="PersonalDetailsModelStoreContainer">          <EntitySet Name="details" EntityType="PersonalDetailsModel.Store.details" store:Type="Tables" Schema="dbo" />        </EntityContainer>

    My app config has the following code

    <configSections>    <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />    <!-- 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" />  </configSections>  <connectionStrings>    <add name="OracleConn" connectionString="data source=dbname;user id=id;password=pwd" providerName="Oracle.ManagedDataAccess.Client" />    <add name="PersonalDetailsEntities" connectionString="metadata=D:\Documents\Visual Studio 2010\Projects\WindowsApplication1\WindowsApplication1\OracleMetadata\OracleModel1.csdl|         D:\Documents\Visual Studio 2010\Projects\WindowsApplication1\WindowsApplication1\OracleMetadata\OracleModel1.ssdl|         D:\Documents\Visual Studio 2010\Projects\WindowsApplication1\WindowsApplication1\OracleMetadata\OracleModel1.msl;         provider=Oracle.DataAccess.Client;provider connection string=&quot;DATA SOURCE=dbname;user id=id;password=pwd;&quot;"         providerName="System.Data.EntityClient" /> </connectionStrings>  <entityFramework>    <providers>      <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />    </providers>    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />  </entityFramework>  <system.data>    <DbProviderFactories>      <remove invariant="Oracle.DataAccess.Client" />      <remove invariant="Oracle.ManagedDataAccess.Client" />      <add name="ODP.NET, Managed Driver" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />    </DbProviderFactories>  </system.data>  <oracle.manageddataaccess.client>    <version number="*">      <edmMappings>        <edmMapping dataType="number">          <add name="bool" precision="1" />          <add name="byte" precision="2" />          <add name="int16" precision="5" />        </edmMapping>      </edmMappings>    </version>  </oracle.manageddataaccess.client>  <runtime>    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">      <dependentAssembly>        <assemblyIdentity name="Oracle.ManagedDataAccessDTC" publicKeyToken="89b483f429c47342" culture="neutral" />        <bindingRedirect oldVersion="0.0.0.0-4.121.2.0" newVersion="4.121.2.0" />      </dependentAssembly>    </assemblyBinding>  </runtime>

    While executing the vb app I get the following error

    Dim context As PersonalDetailsEntities = New PersonalDetailsEntities
            Dim query = From it In context.details
               Where it.id = txtID.Text _
               Select it
            Dim dtls As detail = query.First() ----   error line

    Error: 

    Schema specified is not valid. Errors: 
    OracleModel1.ssdl(2,12) : warning 0005: Could not find schema information for the attribute 'Version'.
    OracleModel1.ssdl(2,2) : error 0010: The element Edmx in namespace http://schemas.microsoft.com/ado/2008/10/edmx was unexpected for the root element. The expected Schema in one of the following namespaces: http://schemas.microsoft.com/ado/2006/04/edm/ssdl, http://schemas.microsoft.com/ado/2009/02/edm/ssdl, http://schemas.microsoft.com/ado/2009/11/edm/ssdl.

    I want to solve this error. There are many papers on web for SQL support for EF6 but hardly any for oracle. If any one has any knowledge how to solve this or any white paper please let me know.

    Thanks 

    Prachin Soparkar

    Thursday, March 26, 2015 5:46 AM

Answers

  • hi, 

    I got this issue solved by removing the following three tags from oracle ssdl file 

    <edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
      <!-- EF Runtime content -->
      <edmx:Runtime>
        <!-- SSDL content -->
        <edmx:StorageModels>

    The app is able to connect to the database. But now the error has changed. It is "{"ORA-00942: table or view does not exist"}". The table details exists in oracle database.

    Let me know if anyone has any solutions. 

    Thanks

    Prachin Soparkar

    Thursday, March 26, 2015 9:16 AM

All replies

  • hi, 

    I got this issue solved by removing the following three tags from oracle ssdl file 

    <edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
      <!-- EF Runtime content -->
      <edmx:Runtime>
        <!-- SSDL content -->
        <edmx:StorageModels>

    The app is able to connect to the database. But now the error has changed. It is "{"ORA-00942: table or view does not exist"}". The table details exists in oracle database.

    Let me know if anyone has any solutions. 

    Thanks

    Prachin Soparkar

    Thursday, March 26, 2015 9:16 AM
  • Hello,

    I am moving your question to the Entity Framework forum for better support.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

    Thursday, March 26, 2015 10:03 AM
  • Hello Prachin Soparkar,

    It is glad to hear that you got a workaround for your original issue, and for your new exception, it seems to be related with the Oracle database. I suggest that you could ask it to the Oracle Entity Framewrok forum:

    https://community.oracle.com/community/database/developer-tools/windows_and_.net/odp.net and since you are following the article written by , i aslo suggest you could also post this feedback to him.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, March 27, 2015 9:16 AM
    Moderator