Visual Modeler inheritance - MappingException

Apr 23, 2012 at 4:47 PM


I am trying to use inheritance in the Visual Modeler but I always get a MappingException on context.AddItem.

Could you point me to a sample that uses inheritance from within the Visual Modeler?

I could do it fine with the "old" nHydrate (set parent-table, same id-name on child, make sure identity = none, set relationships from parent) but I do not get how to do the same on the Visual Modeler.

I made a parent-entity and a child-entity, made the primary key of the child the same name and type as the parent-id but with identity = none and drew an inheritance arrow from parent to child.

In EFDAL I get all the parent-properties on the child-entity and in the database the relationship between the keys seems to be made automagically but when calling AddItem om the EF-context I always get: MappingException - The number of members in the conceptual type 'Test.Data.EFDAL.Entity.Child' does not match with the number of members on the object side type 'Test.Data.EFDAL.Entity.Child'. Make sure the number of members are the same.

My faulty solution can be found at:

What am I missing?


Apr 24, 2012 at 12:26 AM

Please get the latest version and try again. You will need to redefine your inheritance relationship in the model. Also remember the arrow always points to the parent for inheritance. There is more validation to ensure that your identity key is on the base of the inheritance tree now.

Apr 24, 2012 at 7:29 AM

Great, saving as well as loading inherited entities seems to be working fine now.