Search code examples
entity-framework-6many-to-manyedmxedmx-designer

Entity framework many to many relationship association not automatically generated


I've seen this post, my problem is quite the opposite, EF is treating the entities as two separate 1 to many relation, so the User have many UserInRole, and the Role also have many UserInRole entities, shouldn't EF automatically hide the UserInRole table and give a navigation property Roles for User and Users for Role. What I want is actually this:

ef model


Solution

  • Deleting the entity from the edmx and updating changes fixed it, apparently when I updated the model from the database in the edmx designer it kept columns that I removed from the database maybe because it was referenced somewhere else in the project, anyway I deleted the entire entity manually and updated the changes / re-added the missing tables and it did the trick.