Unable to update the EntitySet ‘MyEntity’ because it has a DefiningQuery and no element exists in the element to support the current operation.

Couldn’t find the problem at first, even google didn’t really gave me any thoughts. Untill I noticed that I forgot to set a primary key in the database table. Problem solved. Or so I thought.

Apparently Visual studio created a key itself on the edmx model, off course the wrong one. After a update from database, the model added the correct key, but didn’t removed the key which it had created itself. So I removed it myself, then did an updated the model again from the database. 


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s