Monday 6 November 2017

Unable to update the EntitySet 'stConfigureEmployeeList' because it has a DefiningQuery and no element exists in the element to support the current operation.

This issue arises when you are not handling primary key in your table and try to do any operation in EntityFramework.
When there is no primary key exists in table then EntityFramework automatically take it as a View but in the Code we are considering it as a Entity so that at that time the issue will arise.

There are 2 solutions exists for this,

1/ Add Primary Key in your table and after that again add that table in edmx file and everything will work fine.
2/ if you don't want to add primary key then follow these steps,
   -> Right click on the edmx file, select Open with, XML editor
   -> Locate the entity in the edmx:StorageModels element
   -> Remove the <DefiningQuery> section entirely
   -> Rename the store:Schema="dbo" to Schema="dbo"
   -> Change store:Type="Views" to store:Type="Tables"

0 comments:

Post a Comment