Generic Schema

Generic Schema

Postby 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
Ekki
 
Posts: 29
Joined: Sun 24 Nov 2013 18:50
Location: Ilmenau, Germany

Re: Generic Schema

Postby 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.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Generic Schema

Postby 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
Ekki
 
Posts: 29
Joined: Sun 24 Nov 2013 18:50
Location: Ilmenau, Germany

Re: Generic Schema

Postby 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/MappingKinds.html and in the Entity Developer documentation: ORM Support-> LinqConnect-> Concepts-> Model Generation Templates.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17


Return to dotConnect for PostgreSQL