Monday, September 8, 2014

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

Entity Framework tried to add a record to a table which had Clustered Index but it didn't have Primary Key.

Simple solution was adding the Primary Key.

the reason is treating the table as View, then the EDMX file keep the table as a view in StorageModel\EntitySet\DefiningQuery element. When there is a DefiningQuery the Entity becomes readonly unless you add modification functions, the other solution can be adding modification functions like Stored Procedures for Inserting, Updating, and Deleting.

Share/Bookmark

No comments: