Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework 5 mixing Oracle & SQL Server

I have 2 data layer DLL projects. One is hitting Oracle tables and the other SQL Server. Each one works on their own when used in separate projects.

When I make a project that includes both DLL's I get the following error when an Oracle table is queried:

Schema specified is not valid. Errors: Model.ssdl(2,48) : error 0172:
All SSDL artifacts must target the same provider. The Provider 'Oracle.ManagedDataAccess.Client' is different from 'Oracle.ManagedDataAccess.Client' that was encountered earlier. Model.ssdl(2,81) : error 0169: All SSDL artifacts must target the same provider. The ProviderManifestToken '2008' is different from '11.2' that was encountered earlier.

The crazy thing is, in my 1 project that includes 2 data layers projects if I comment out a function that has usage of the SQL Server data layer (even though it never actually gets called at this time) then it works. Somehow the presence of it's code causes this error above. How can I mix SQL Server and Oracle entity framework?

like image 320
user441521 Avatar asked Jun 27 '14 18:06

user441521


2 Answers

My code started to work when I moved the Oracle DB connection and query into a separate method.

I was under the impression that I should keep the Oracle connection open for all queries because it would be inefficient otherwise, but apparently this is actually done automatically under the hood. Now that the scope of the two connections are entirely separate it is working.

Why? No idea...

like image 126
Michael Sandler Avatar answered Nov 13 '22 04:11

Michael Sandler


try with devart dotConnect:

Simultaneous Oracle and SQL Server Support in Entity Framework with Designer Generated Objects
Using Oracle and MS SQL Server in Entity Framework applications simultaneously

like image 35
Naami Avatar answered Nov 13 '22 05:11

Naami