I have many-to-many relationship between Projects and Models in my database
I am using this command to generate the .cs models:
Scaffold-DbContext "my connection string here" Microsoft.EntityFrameworkCore.SqlServer -OutputDir EFModels -Force -Context EFEntities -Tables Projects, Projects_Models, Models
In EF6, this would create
Model.Projects properties, without mapping the Projects_Models table into its own class.
But in this case (EF Core), it created a
ProjectsModel class, and
Model.ProjectsModels properties instead.
How can you make it behave like it was in EF6?
It is not currently possible to do this in EF Core as that feature has not yet been added. From the docs:
Many-to-many relationships without an entity class to represent the join table are not yet supported. However, you can represent a many-to-many relationship by including an entity class for the join table and mapping two separate one-to-many relationships.