[Linq2Sql]ForeignKeyReferenceAlreadyHasValueException

  • 1196
  • 0

[Linq2Sql]ForeignKeyReferenceAlreadyHasValueException

場境:

有ForeignKey 且已先填入資料, 然後想改PK value. 如:

   1:  Job job = new Job{ Owner= new Owner( ){ ...  } }; // 已放入FK
   2:  job.Id = 1; // 然後想改PK    

簡單的說, 要把PK先搞定.