モデルに 2 つのオブジェクトがあります
車と車のパーツ
1:n の関係で。
実体車のカスケードを削除したい。削除すると、次の例外が発生します。
The operation failed: The relationship could not be changed because one or
more of the foreign-key properties is non-nullable. When a change is made
to a relationship, the related foreign-key property is set to a null value.
If the foreign-key does not support null values, a new relationship must
be defined, the foreign-key property must be assigned another non-null value,
or the unrelated object must be deleted.
最初に車のオブジェクトを削除してから、車の部品を削除しようとしていると思います。
外部キーが原因でこれは不可能です。
どうすればこれを処理できますか?
明らかに、最初に carPart を削除してから車だけを削除したいと思います。
ありがとう。