I have a table that has a composite key, which consists of two int fields and one varchar (50) field. I made the composite key my primary key, which I usually do not do. Yes, yes, yes, I am more than familiar with the logical key and the surrogate key debate, but I had to do some hard drugs (not really) the day I made the table, since I went with the logical key approach of using the surrogate ( which I almost always do).
My problem: LINQ will not allow me to make an update in the varchar (50) column, which is part of the composite key. It throws an exception "Property" Value "is part of the key information of the object and cannot be changed." “Value” is the name of the field (and please don’t give me lectures on using reserved words for column names ... as I said, I was on serious drugs per day).
So where does this leave me, except between a rock and a solid place? The table in question does have a unique identification column (although this is not a primary key), and this column is used in an external key in another table. So, I can’t very easily do some hack, how to delete the specified record and re-add it, because it will force me to track fk in other tables and then add them again. What a nightmare...
Does anyone know a simple way around this problem without forcing me to make significant changes to the table structure?
source
share