Schema Name

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
aKhan1
Posts: 2
Joined: Tue 22 Mar 2016 14:37

Schema Name

Post by aKhan1 » Tue 22 Mar 2016 14:53

I am using devart to connect to postgresql. I am using Entity Developer 5.8.791, Devart.Data version 5.0.1355.0, and Devart.Data.PostgreSql version 7.4.563.0. I need to know if there is a way that I can use the tool to not hardcode the schema name in the Context class files and instead pick the schma name from the web.config file. Right now the schmea name is in 4 places...

- hard coded or alias in all the class files for the database tables like [Table(Name = @"myschema.reimbursement_rates")]

- *.lqml as <Connection Mode="ConnectionString" ConnectionString="User Id=a.Khan;Host=localhost;Database=mydb;Integrated Security=True;Initial Schema=myschema" Provider="Devart.Data.PostgreSql" />,

- *.edps as in <ModelFirst StorageSynchronizationEnabled="False" TargetSchema="myschema">

- web.config file

Requirement: What I want is that the schema name is only at one location (web.config file). The reason is because I will be using updated db with a specific naming convention, so I want to change the schema name in config file only. Can you please direct me to the appropriate solution and I need to know as soon as possible since my program is going live? I will appreciate your quick response.

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

Re: Schema Name

Post by Shalex » Wed 23 Mar 2016 17:34

There are the following ways to remove the schema name:

1) open your *.lqml model in Entity Developer (stanalone or integrated in Visual Studio), navigate to Tools > Entity Developer > Model Explorer, select each class and edit its Source property (remove the schema prefix)

2) for the newly created models, you can clear the "Preserve schema name in storage" option on the Model Properties step. Or for the existing models, you can set the same option via Model Properties and, after this, the entities you drag&drop from Database Explorer to the diagram surface or Model Explorer will be without schema prefix in Source

As a result, Entity Developer will generate [Table(Name = @"reimbursement_rates")] instead of [Table(Name = @"myschema.reimbursement_rates")].

Post Reply