InvalidOperationException when a 2 db system ( Oracle & SQLServer) is initialized

InvalidOperationException when a 2 db system ( Oracle & SQLServer) is initialized

Postby darioaxel » Thu 07 Apr 2016 10:33

Hi,

We´re developing a system that needs two different databases. Each client has its own old db in Oracle or SQLServer from where we get info, and the new project SQLServer db with migrations.

If the client uses also SQLServer, the project build without problems and can be deployed nicely. But as soon as the system is mixed ( the client uses Oracle) we get an InvalidOperationException when the Database.SetInitializer method is called.
The system tries to execute this select:
Code: Select all
select cast(serverproperty('EngineEdition') as int)
over the SQLServer db without event existing and the result is null, so the deploy fails.

Did anyone deal with something similar or know what can be happening?

Connectionstrings seem to be fine, but we have no idea what can be failing..
Code: Select all
    <add name="EPDbConnection" connectionString="Server=DBSERVER;Database=HR.EP;Trusted_Connection = True;MultipleActiveResultSets=True;" providerName="System.Data.SqlClient" />
    <add name="ClientDbConnection" connectionString="user id=FOO; password=TOO; Host=172.0.0.1; Service Name=oracle10; Port=1522; Direct=true;" providerName="Devart.Data.Oracle" />
darioaxel
 
Posts: 1
Joined: Thu 07 Apr 2016 09:57

Re: InvalidOperationException when a 2 db system ( Oracle & SQLServer) is initialized

Postby Shalex » Fri 08 Apr 2016 06:19

darioaxel wrote:We´re developing a system that needs two different databases. Each client has its own old db in Oracle or SQLServer from where we get info, and the new project SQLServer db with migrations.
We recommend you to use the following approach: one base context, two descendants for each provider. Each descendant should have its own configuration and code-first code-based migrations.

An EF Code-First sample is available at http://blog.devart.com/entity-framework-6-support-for-oracle-mysql-postgresql-sqlite-and-salesforce.html#Samples.
The dotConnect-specific notes about EF Code-First Migrations are here: http://blog.devart.com/entity-framework-code-first-migrations-support-for-oracle-mysql-postgresql-and-sqlite.html.
Shalex
Devart Team
 
Posts: 7460
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for Oracle