0

I have three tables: user, specialUser and special

User contains all the base fields. specialUser has an id which is both, the FK (to user table) and PK and has another field specialId, which is a FK to the special table.

Now, when I add the tables to the edmx, EF has merged the specialuser with the user entity! User now has an extra navigation property to special. I don't want this. I want to have a separate entity for specialuser.

How can I force EF 6 not to merge these entities?

Martijn
  • 24,441
  • 60
  • 174
  • 261
  • How are these entities related? Do they have an inheritance relationship? –  May 17 '18 at 13:24
  • That is what I want to achieve. User as the base and specialuser as the child – Martijn May 17 '18 at 13:26
  • Okay, it's doing "Table Per Hierarchy". You need/want "Table Per Type" or "Table Per Concrete Class". https://stackoverflow.com/questions/22263189/entity-framework-db-first-implement-inheritance –  May 17 '18 at 13:32
  • Thanks, i also found that question, but my problem is that in his case Identity is merged with Person (i don't have additional properties for now in my child entity) – Martijn May 17 '18 at 13:34

1 Answers1

0

I had that issue in the past, the only way I got the result I wanted is adding an extra column to the table, like EF_FIX bit nullable to the table.

add something like this to specialUser and it should do, i think, what you want

Fredou
  • 19,848
  • 10
  • 58
  • 113