How to fix if unable to update the EntitySet

Unable to update the EntitySet

Unable to update the EntitySet. Because it has a DefiningQuery and no <UpdateFunction> element exist.

When executing an insert query got this error



Image 1.

This type of exception comes usually when entity set is mapped from database view, custom database query or if database table doesn't have primary key.

Check your Data Base table.



Image 2.

As you can see there is no primary key define for above table so make changes in the table:


Image 3.

Now enjoy your query.

Next Recommended Reading How to Update Session Object in C#