Cross-DBMS access with single model

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
Andrei Lisin
Posts: 6
Joined: Wed 25 Sep 2013 14:06

Cross-DBMS access with single model

Post by Andrei Lisin » Wed 25 Sep 2013 14:26

My application should support oracle and mssql with EF5. Is it possible with single model and classes generated from it? As I understand, I would need at least a different SSDL and connection string for different databases. Is that enough? Can it work at all?

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

Re: Cross-DBMS access with single model

Post by Shalex » Thu 26 Sep 2013 12:59

Usage of SQL Server and Oracle simultaneously in one application can be implemented in the following alternative ways:

1. Creating repositories for 2 models

2. Using mapping which is loaded dynamically:
2.1. With 2 *.edmx (or 2 *.edml). Only one of them generates the code of model and entity classes, another one is used as a source of XML resources (example: http://www.devart.com/efquerysamples.zip)
2.2. Only one model and database independent fluent mapping: http://blog.devart.com/entity-developer ... plate.html

3. Code-First approach: http://blog.devart.com/entity-framework ... qlite.html. This article includes reference to the sample "Code-First for All Databases" which shows the way how to access different databases with the same code.

Despite the approach you will choose, we recommend you to employ Devart Entity Model (*.edml): http://www.devart.com/entitydeveloper/ed-vs-edm.html.

Andrei Lisin
Posts: 6
Joined: Wed 25 Sep 2013 14:06

Re: Cross-DBMS access with single model

Post by Andrei Lisin » Thu 17 Oct 2013 14:15

Shalex wrote:Despite the approach you will choose, we recommend you to employ Devart Entity Model (*.edml): http://www.devart.com/entitydeveloper/ed-vs-edm.html.
Entity Developer generates ObjectContext.

http://blogs.devart.com/dotconnect/enti ... plate.html
Following that, we remove the standard code generation template and enable the DbContext template.
Ermm... how?

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

Re: Cross-DBMS access with single model

Post by Shalex » Thu 17 Oct 2013 14:49

Andrei Lisin wrote:http://blogs.devart.com/dotconnect/enti ... plate.html
Following that, we remove the standard code generation template and enable the DbContext template.
Ermm... how?
Navigate to View > Model Explorer (in a standalone Entity Developer) or Tools > Entity Developer > Model Explorer (in Visual Studio), open the Templates node, remove EntityObject and add DbContext.

Post Reply