Map Entity To Multiple Tables
Map Entity To Multiple Tables
Is there a way to map an entity (Code First) using attributes to multiple tables?
Please specify which ORM you are using. Am I correct supposing that this is LinqConnect?
As for mapping several tables to a single entity, please specify whether you mean mapping all rows to a single entity type (like it is done when joining tables) or loading the same or similar rows from multiple tables (like 'union' does). In the first case, it is only possible with the means of the TPT inheritance:
- specify the base type for the first table;
- determine a new descendant class for each additional table;
- in your code work only with the last descendant.
As for mapping several tables to a single entity, please specify whether you mean mapping all rows to a single entity type (like it is done when joining tables) or loading the same or similar rows from multiple tables (like 'union' does). In the first case, it is only possible with the means of the TPT inheritance:
- specify the base type for the first table;
- determine a new descendant class for each additional table;
- in your code work only with the last descendant.