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