A bit upset here. I am trying to find a way to support cascading updates using an entity infrastructure, and there seems to be no built-in way. Online research basically shows that everyone says that in any case you should never change the value of the primary key, but there are valid cases when you need (for example, the UPC value as the primary key, and the UPC barcodes now become larger , which means updating existing and maintaining relationships with a foreign key).
One approach, apparently, is to use the SavingChanges event, see if the primary key fields change, and if so, navigate through the navigation properties and thus update the auxiliary tables.
This will theoretically work. But it just sounds bulky. Anyone have a better idea? I can’t believe that Bill would leave this material out of the box just because most people don’t. SQL Server still supports it ...
thank!
source
share