"the property 'name' is part of the object's key information and cannot be modified. entity framework" Code Answer


see the answer from yildizm85 to this question: entity framework not working on table without identity column

"entity framework requires a primary key to generate a model from the database. if there is no primary key on a table it will simply select the non-nullable columns as a concatenated primary key and the entity will be read/only."

looking at your eat_sourcenames object it appears there is no primary key field so the entity framework is using the column 'name' as part of the composite key which means it is read-only.

the solution would be to add a primary key field to eat_sourcenames and then your 'name' field would no longer be part of the primary key.

By Florent Morin on October 16 2022
Only authorized users can answer the Search term. Please sign in first, or register a free account.