Entity Framework for SQL-Server && ORACLE

J

jasc

I am not sure whether this is the right newsgroup, but as I develop with
C#...

EF for SQL Server is not a problem. But unfortunately about 1/3 of our
clients have and will stick to Oracle. So here is my question: is there a
way to use EF together with SQL Server and Oracle? So far I have not found
anything convincing on the net. The solution should allow switching at
runtime between the 2 database types.

My regards to this group
 
M

Mr. Arnold

jasc said:
I am not sure whether this is the right newsgroup, but as I develop with
C#...

EF for SQL Server is not a problem. But unfortunately about 1/3 of our
clients have and will stick to Oracle. So here is my question: is there a
way to use EF together with SQL Server and Oracle? So far I have not found
anything convincing on the net. The solution should allow switching at
runtime between the 2 database types.

My regards to this group

The EF is an ORM solution, which is a virtual database solution, dealing
with entities/objects. You can have a EF model based on SQL Server and an EF
model based on Oracle in the same solution, with code addressing each model
at runtime.

Your key here will be to use DTO(s) Data Transfer Objects in this situation.
If the database schemas are generally the same between the two models, you
can populate DTO(s) that are common to both models. The DTO is based on a
entity on the model with like properties as the entity it is representing,
and the respective entity between the two models will map data into a DTO.

Data in the DTO is persisted to an entity on the model based on the path
that is taken of (SQL Server or Oracle) code to be used, but the DTO is the
same between the two sets of code. And yes, you will have two sets of code
in a method to deal with the path taken.

As for a runtime switch to know what database to use, this can be done with
an App or Web.config using the <AppSettings> tag, which can be accessed from
code.





__________ Information from ESET NOD32 Antivirus, version of virus signature database 4299 (20090802) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top