TPH Designer Problem
Posted: Sun 21 Aug 2016 19:22
I've got a problem with with Entity Developer and some inherited classes using the TPH strategy.
My inheritance structure consists of one abstract base class (MeetingItemBase) and two inherited concrete classes (MeetingItem and MeetingTodoItem). These classes should be mapped to one table called "meeting_items".
As my project relays on an existing database I created the model from the database. During the creation of the model from the database the designer only showed one class, so I created the two derived classes by hand and set the automatically created class as base class and marked it as abstract. I also renamed the classes to match the names of my desired structure.
My problem is now that sometimes the Entity Developer forgets about the mapping of the classes to the table. When I right-click on the classes and choose "Mapping Details" the base class is not mapped to a table at all.
The problem is when I query for all table entries like
from i in context.MeetingItemsBase
select i;
I get an error message like tablemeetingitembases does not exist.
When I change the table mappings in a way that the base class is also mapped to the table and all properties that the concrete classes share are mapped in the base class the query above works without error message.
The problem is that the entity developer resets my changes from time to time (although I have not recreated the model) to the original settings.
I'm using the dotConnect MySQL data provider to connect to an existing database and created the model from there, but I don't think the problem is related to the data provider.
My inheritance structure consists of one abstract base class (MeetingItemBase) and two inherited concrete classes (MeetingItem and MeetingTodoItem). These classes should be mapped to one table called "meeting_items".
As my project relays on an existing database I created the model from the database. During the creation of the model from the database the designer only showed one class, so I created the two derived classes by hand and set the automatically created class as base class and marked it as abstract. I also renamed the classes to match the names of my desired structure.
My problem is now that sometimes the Entity Developer forgets about the mapping of the classes to the table. When I right-click on the classes and choose "Mapping Details" the base class is not mapped to a table at all.
The problem is when I query for all table entries like
from i in context.MeetingItemsBase
select i;
I get an error message like tablemeetingitembases does not exist.
When I change the table mappings in a way that the base class is also mapped to the table and all properties that the concrete classes share are mapped in the base class the query above works without error message.
The problem is that the entity developer resets my changes from time to time (although I have not recreated the model) to the original settings.
I'm using the dotConnect MySQL data provider to connect to an existing database and created the model from there, but I don't think the problem is related to the data provider.