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

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
darioaxel
Posts: 1
Joined: Thu 07 Apr 2016 09:57

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

Post by 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" />

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

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

Post by 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 ... ml#Samples.
The dotConnect-specific notes about EF Code-First Migrations are here: http://blog.devart.com/entity-framework ... qlite.html.

Post Reply