I have a table with a composite primary
key made up of 3 fields
. It just so happens, that one of these fields can change, so what happens is that when I want to update a record in the database and I change field3
(part of the primary key), the entity framework
can't find the record to update because I have changed one of the primary key fields. Is there something I can do to solve this with the following limitations?
- I can't change the primary fields.
- I can't add an identity field and make it primary.
- In a nutshell, I can't modify the schema.
This is not good database design and it was designed a while ago for individual hardware systems, so that is why I can't change the schema, because these individual units expect the schema in a certain way, otherwise, I would have designed it differently.
I understand primary keys should be immutable, but is there some sort of trick or hack I can use to update an existing record with a modified primary key without changing the schema?