Vinicius Ottoni
Vinicius Ottoni

Reputation: 4677

Many-to-Many table is mapped as an entity with EF6 database first

I have an Issue with Many-to-Many mapping. I have the following tables created on MySql database:

CREATE TABLES

In edmx I tried to map it with Update Model From Database:

MAPPING TABLES

But when the tables are mapped, the table Many-to-Many usuarios_conquistas is mapped as an Entity (not only a relationship between tables usuarios and conquistas):

TABLES MAPPED

Anyone knows what I'm doing wrong?

Upvotes: 0

Views: 159

Answers (1)

Amirton Chagas
Amirton Chagas

Reputation: 154

The "usuario_conquistas" table should not have a column Id, it should use the columns IdUsuario and IdConquista as a composite primary key.

Upvotes: 1

Related Questions