Generic Schema

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
Ekki
Posts: 34
Joined: Sun 24 Nov 2013 18:50
Location: Ilmenau, Germany
Contact:

Generic Schema

Post by Ekki » Wed 27 Nov 2013 13:34

Hi,

my use case requires full parameterization of database name and schema name. While the database name is already parametric, I face the issue that the schema name is part of the table annotations in the generated context files:

[Table(Name = @"""<SCHEMA>"".""<TABLE>""")]

What is the correct way to solve this (really hope there's a way…)?

Thx ia,

Ekki

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Generic Schema

Post by MariiaI » Thu 28 Nov 2013 11:48

Please do the following:
- clear the "Preserve schema name in storage" check box in the Model Settings (double-click on the diagram);
- re-create your model in order to changes become effective for all Entity classes ( select "Regenerate Storage and Mapping" from the diagram shortcut menu or use the "Update Model from Database" wizard with the selected "Recreate Model" option);
- save the changes to re-generate the code.
After this you should get the following:

Code: Select all

[Table(Name = @"""Table""")]
Please tell us if this helps.

Ekki
Posts: 34
Joined: Sun 24 Nov 2013 18:50
Location: Ilmenau, Germany
Contact:

Re: Generic Schema

Post by Ekki » Thu 28 Nov 2013 13:11

just works!

There's still an attribute [DatabaseAttribute(Name = "ig")] in the generated code but this is obviously ignored as I can set the database when creating the Context.

You guys rock!

Ekki

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Generic Schema

Post by MariiaI » Fri 29 Nov 2013 12:11

There's still an attribute [DatabaseAttribute(Name = "ig")] in the generated code
If you don't want to use attribute mapping, you can also use file mapping with LinqConnect template (set Mapping Mode to File in the Model settings) or use the POCO Entity and Fluent Mapping templates.

Please refer to http://www.devart.com/linqconnect/docs/ ... Kinds.html and in the Entity Developer documentation: ORM Support-> LinqConnect-> Concepts-> Model Generation Templates.

Post Reply