Note that there are some explanatory texts on larger screens.

plurals
  1. POTable-per-hierarchy and inheritance implementation issue
    primarykey
    data
    text
    <p>I am migrating an old ASP application to a modern .NET version, to cut down on development times we are looking at the .NET 4.0 Entity Framework. However, we seem to have hit a brick wall in our development with this issue.</p> <p>Given is a small part of our database: A table OBJECT which contains a list of cars and their respective properties. We also have a table OBJECT_OPTIONS which contains, for a given car in OBJECT, a list of OPTIONS, ACCESSORIES and STANDARD EQUIPMENT. These three types all have the same fields and are therefor stored in the same table. The column ncopt_type is used to discriminate between the different lists. Possible values are: 'opt', 'acc' and 'sta'. The table OBJECT_OPTIONS links to OBJECT via ncopt_obj_id which represents a unique car (obj_id) in table OBJECT.</p> <p>Our goal is to provide the OBJECT entity with 3 properties that link to the different OBJECT_OPTIONS lists: - property OPTIONS - property ACCESSORIES - property STANDARDEQUIPMENT</p> <p>We've tried different tutorials and walkthroughs concerning the table-per-hierarchy via inheritance model but haven't succeeded in creating a buildable model.</p> <p>Technically what we did was:</p> <ul> <li>Create entity OBJECT</li> <li>Create entity OBJECT_OPTIONS, make it abstract</li> <li>Add entities OPTION, ACCESSORY and STANDARD_EQUIP all using basetype OBJECT_OPTIONS</li> <li>Add conditions to all three tables on ncopt_type = '...'</li> <li>Add 3 navigational properties to OBJECT, all linking to one of the inherited entities: OPTIONS, ACCESSORIES and STANDAARD_EQUIPMENT</li> </ul> <p>A bunch of errors shows up during this setup, but we end up with this one: </p> <blockquote> <p>Error 3032: Problem in mapping fragments starting at lines 250, 286:EntityTypes NCO.Model.OPTION, NCO.Model.ACCESSOIRE, NCO.Model.STANDAARD_EQUIP are being mapped to the same rows in table OBJECT_OPTIES. Mapping conditions can be used to distinguish the rows that these types are mapped to.</p> </blockquote> <p>There is a condition present on all three objects though.</p> <p>I have found no solution to this problem and have spent way too much time on it already. We are currently using a workaround method but would love to get this fixed as this situation will present itself a few more times by the end of the project.</p> <p>Any help appreciated, if you need more information, please drop me a comment or an email.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload