When I try to delete an object, I get a 'System.InvalidOperationException' with the following additional information:
The operation failed: The relationship could not be changed because one or more of the foreign-key properties is n开发者_如何学Pythonon-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.
How can I get more information? This message is like "something's wrong, but we are not going to reveal what"
The object/row you've tried to delete is probably a foreign key - the foreign key can't be null in the related table. Try deleting the other object/row first.
This issue would also happen if you tried to do this in SQL, you'd get:
The DELETE statement conflicted with the REFERENCE constraint 'FK_foo_bar'. The conflict occured in database...
精彩评论