Cross-DBMS access with single model
-
- Posts: 6
- Joined: Wed 25 Sep 2013 14:06
Cross-DBMS access with single model
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?
Re: Cross-DBMS access with single model
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.
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.
-
- Posts: 6
- Joined: Wed 25 Sep 2013 14:06
Re: Cross-DBMS access with single model
Entity Developer generates ObjectContext.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.
http://blogs.devart.com/dotconnect/enti ... plate.html
Ermm... how?Following that, we remove the standard code generation template and enable the DbContext template.
Re: Cross-DBMS access with single model
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.Andrei Lisin wrote:http://blogs.devart.com/dotconnect/enti ... plate.htmlErmm... how?Following that, we remove the standard code generation template and enable the DbContext template.