Problem converting table-per-type to table-per-hierarchy

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
billster6809
Posts: 29
Joined: Mon 27 Jan 2014 21:08

Problem converting table-per-type to table-per-hierarchy

Post by billster6809 » Tue 16 Dec 2014 22:14

Entity Developer Version: 5.7.500
Entity Framework Version: 6.1.1
Visual Studio 2013 Premium

I have an existing set of entities which are defined in a table-per-type hierarchy. There are 14 types derived from the base type. Eight add no new properties. They are defined just to separate entries. The base class is Selection, which has Id, Text, Description, Order and History (a complex). Derived classes are such as ObtainedFrom and RemovalWhere which add no new properties, or Maturity which adds a navigation property.

I wanted to convert this to a table-per-hierarchy tree, but it is failing. Here are the steps I performed. I will list the errors as I proceed:
0. Bring up the model in stand-alone Entity Developer (I get same problem in Visual Studio)
1. In the base class, I added a 20-character string property (char type), SelectionType.
I right-clicked the property to "Create Storage and Mapping"
2. I right-clicked on the first derived class inheritance line and chose edit.
3. I changed the type to Table Per Hierarchy. I set
StorageColumn = SelectionType
Base Condition = "Is Null"
Derived Condition "=", value="ObtainedFrom"
4. Select OK. I said Yes to removing the SelectionType property from Selection
5. I have a bunch of errors for the remaining child classes; that is expected.

If I now immediately bring up the same editor again, for Storage Column it displays "< Mapping to several tables is ...". It is grayed out, so I cannot drop the list down to see the full message.

6. I ignore that and go ahead and set the inheritance mapping for the other classes, selecting for the Derived Condition the name of the entity type. They all show the "<Mapping to several tables is ..." message if re-edited.

When all types have had their inheritance edited, the errors are gone. I can save the edml file. I can generate a database script from the model. All is good.

7. Close model, reopen. I now get 6 of the following error:
Problem in mapping fragments starting at lines 19, 101:An entity is mapped to different rows within the same table. Ensure these two mapping fragments do not map two groups of entities with overlapping keys to two distinct groups of rows.
The errors all are "19,", but the second half are 101, 118, 134, 150, 166, 182. I don't know where those are. They do not correspond to lines in the edml file.

Is there something I am doing wrong in the conversion? Or is something broken in entities in other parts of the model which have navigation properties referring to these selections?

Can you explain the errors and how I would remove them?

billster6809
Posts: 29
Joined: Mon 27 Jan 2014 21:08

Re: Problem converting table-per-type to table-per-hierarchy

Post by billster6809 » Tue 16 Dec 2014 22:21

Oh, and when I examine the inheritance editor after reopening, all of the derived classes have been set to "Table Per Concrete Type"

Shalex
Site Admin
Posts: 8242
Joined: Thu 14 Aug 2008 12:44

Re: Problem converting table-per-type to table-per-hierarchy

Post by Shalex » Fri 19 Dec 2014 18:17

Thank you for your report. We will investigate the issue and notify you about the result.

Shalex
Site Admin
Posts: 8242
Joined: Thu 14 Aug 2008 12:44

Re: Problem converting table-per-type to table-per-hierarchy

Post by Shalex » Tue 30 Dec 2014 12:36

Please turn on the Model Settings > Synchronization > Mapping > "Enable automatic synchronization of storage part and mapping of the model with its conceptual part" option of your initial model on the step 0 and repeat steps 1 through 7. Does this help?

If not, send us the following:
1) the model you open on the step 0
2) the model you get on the step 7
3) specify your current build of Entity Developer

Post Reply