Error Message: The property is part of the object's key information and cannot be modified
Introduction: Sometimes we get an error “The property is part of the object's key information and cannot be modified “ while trying to change the value of model class with entity framework whether you use MVC or ASP.NET. This issue comes when the property you are trying to update is in the list of object key collection of Entity model. To Resolve this we can follow below steps.
Step 1: Check whether your table is having a primary key column in the database or not. If it does not have any primary key then add a primary key. Because if we don't add a primary key to the table than entity framework creates its own key collection and add all columns in it.
Step 2: Open your .edmx file to see table object mapping. You will be able to see each column of the table is having an icon like the primary key. So Write click on your page and update .edmx from the database.
Step 3: If you still see same primary key icons on all columns then click on column name you want to update one by one and go to property window and Set Entity Key property to false.
Now your code will run error free.