1
votes

Can't add model error screenshot

I got error when try to create ADO.NET Entity Data Model from existing Oracle 11g database

Server Explorer Image.

My connection string worked on server explorer but when I try to create ADO.NET Entity Data Model. I downloaded ODAC 12c Release 4 and Oracle Developer Tools for Visual Studio (12.1.0.2.4) (32 bit) and Oracle.ManagedDataAccess( 64bit) from nuget.

I am using Visual Studio 2015, Entity Framework 6, Oracle 11g, Windown 10 pro 64 bit

<configuration>
    <entityFramework>
        <providers>
            <provider invariantName="Oracle.ManagedDataAccess.Client" 
                      type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />

<configuration>
    <configSections>
        <section name="Oracle.ManagedDataAccess.Client" 
                 type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />

I added some config to web.config but it doesn't work.

1
Try opening project properties => Build => Platform target => set to x86, then rebuild project & add entity data model. - Tetsuya Yamamoto
i set to x86, rebuild and try to add entity data model but still same error :( - nguyenba nguyen nguyen
What is your version of ODAC & ODT currently installed? ODAC 12c R3 supports EF6, which should be consider then. Also try setting provider to this: <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />. - Tetsuya Yamamoto
i downloaded ODAC 12c Release 4 and Oracle Developer Tools for Visual Studio (12.1.0.2.4) (32 bit) . It is ODAC 12r4 because 12r3 doen't support visual studio 2015. i'll check settring privider now - nguyenba nguyen nguyen
Finally my project worked after-publishing too. I install the Oracle.ManagedDataAccess v12.2.110 from nuget( version 64bit which only support runtim) and remove some line from web.config which cause IIS buged .And change my connection string from ezconnect to TNS Now it work for both dev/ product eviroment :D. - nguyenba nguyen nguyen

1 Answers

1
votes

Found The way to get it work, first you need to install entityframework 6 from nuget and then change the web.config file :

<entityFramework>
<defaultConnectionFactory type="Oracle.ManagedDataAccess.EntityFramework.OracleConnectionFactory, Oracle.ManagedDataAccess.EntityFramework">
</defaultConnectionFactory>
<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>

But you need to add Oracle.ManagedDataAccess.EntityFramework.DLL , get it from
ODAC 12c Release 4 and Oracle Developer Tools for Visual Studio (12.1.0.2.4) odac 12 RC4 FOR VISUAL 2015, EF 6 my location for that file is D:\app\client\Unknow\product\12.1.0\client_1\odp.net\managed\common\EF6 where D is harddisk and Unknow is your pc name. In the end it is install ODAC 12c r4,EF6, change config file like the code and add Oracle.ManagedDataAccess.EntityFramework.DLL to reference so you can use DB first with Oracle db like a boss :D