EF Model First and devart for both oracle and sql server

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
joeu
Posts: 9
Joined: Wed 18 Aug 2010 17:12

EF Model First and devart for both oracle and sql server

Post by joeu » Fri 01 Oct 2010 16:23

How would i go about using the "Model first" approach that would work for both oracle and sql server?
(obviously i would like to create only one model that works for both)

Could i then create both db schemas from this?

thanks
joe

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 04 Oct 2010 11:24

The most straightforward way to achieve the appropriate results is to create a model for SQL Server, and then generate the database script for the Oracle database. After some minor SSDL adjustments there should be two models using the same CSDL and MSL, with the different SSDL layers.
Don't forget to set the correct metadata paths in the connection strings.
Take a look at this post concerning the work with MSSQL and Oracle, for example.

joeu
Posts: 9
Joined: Wed 18 Aug 2010 17:12

Post by joeu » Tue 05 Oct 2010 14:28

so far i:
#created a model for sql

#copied the model objects to another model (oraModel) and used the devart .tt to generate a sql script

#edited the ssdl to remove the schema="MyUser"

#fixed the app.config to point to new ssdl

1. The sql script generated contained a schema name prefix on every table that was quoted and therefore not recognised,
1. Is there a way to stop this being quoted?
2. Is there a way to stop this being added in the first place?
3. Is there a better way to create the sql script?

4. Is there a way to stop the schema="MyUser" being added to the ssdl?

3. Why are the table names quoted in oracle? e.g tableA in Sql is "tableA" in Oracle

4. why are the column names quoted in oracle? e.g columnA in Sql is "columnA" in Oracle

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 08 Oct 2010 11:51

Go to the %Program Files%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\Devart SSDLToSQL.ttinclude file.
It contains the Quote method.
You can adjust the generation of the schema name, and schema name and column quoting by modifying this method.

joeu
Posts: 9
Joined: Wed 18 Aug 2010 17:12

Post by joeu » Tue 12 Oct 2010 14:11

having everything quoted looks odd, can you explain why you decided to quote table names, column names etc?

How hard would it be to undo this?

if I remove the quotes in the script surely there is another file that pre-defines the quotes that are created during the construction of the queries that i would need to modify?

Thanks
Joe

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 14 Oct 2010 14:33

Actually the quoting in the generated script is designed to preserve the original case of names.
Is the unnecessary quoting in queries reproducible using the latest build?

Post Reply