Hi to all,
I am making a software that is able to handle local and remote databases. The local one is an SQLite , the remote is an PostgreSQL database. The handling of databases is implemented into a DLL.
As far as the structure, these two databases are the same: same tables, tables have the same columns.
My initial imagination was that I would make two models with Entity Developer. One modell would handle the first, the other would handle the second database. I got into the fault that since table names are the same, these two modells cannot fit into the same project, because duplications occure due to same names.
It is not hard to rename classes with a prefix in the following way: lTable1, lTablle2, … rTable1, rTable2, or use different namespaces, but I would avoid this method if possible.
Is there any regular solution for this?
Thanks:
Imre
Multiple entities
There are two ways:
1. XML mapping. As a possible solution, you can define your, for example, PostgreSQL model as a "primary" model that is used for code generation. The second (for SQLite) model will contain only SSDL part. Please refer to our EFQuerySamples ( http://www.devart.com/dotconnect/oracle ... amples.zip ) to get an example how to work with several SSDL parts for different databases.
2. Fluent mapping. For more information on how to use fluent mapping (code first) in our EF-providers, see Entity Framework Code-First support for Oracle, MySQL, PostgreSQL and SQLite. You can also download a sample for serveral databases there.
1. XML mapping. As a possible solution, you can define your, for example, PostgreSQL model as a "primary" model that is used for code generation. The second (for SQLite) model will contain only SSDL part. Please refer to our EFQuerySamples ( http://www.devart.com/dotconnect/oracle ... amples.zip ) to get an example how to work with several SSDL parts for different databases.
2. Fluent mapping. For more information on how to use fluent mapping (code first) in our EF-providers, see Entity Framework Code-First support for Oracle, MySQL, PostgreSQL and SQLite. You can also download a sample for serveral databases there.
-
- Posts: 18
- Joined: Thu 11 Mar 2010 20:36