Okay, here\'s the scenario. I have 3 tables. One called aspnet_Users one called Categories and a linking table called User_Categories. aspnet_Users and Categories both ha
Put a composite primary key on the mapping table, this will tell EF to handle it correctly.
I assume the full exception message is something similar to:
Unable to update the EntitySet YourTableName because it has a DefiningQuery and no InsertFunction element exists in the ModificationFunctionMapping element to support the current operation.
This will occur if your DB's table doesn't have a primary key defined.
Add a primary key to your table (using SQL Server Management Studio or whatever), and update your .edmx
model from the database.
I encounter the same problem, and I fixed by the following link:
I remove the section of DefiningQuery in .edmx based on the content of 3rd link. And then everything works as a charm.
Error: Unable to update the EntitySet because it has a DefiningQuery
Twice I got this error, twice I searched for answers everywhere, and in the end my mappings was messed up or the database had no primary key or something. I suggest checking it all out...