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.
这个通用错误很烦人,我如何找出外键失败的原因。
答案 0 :(得分:0)
截至我了解您的问题,实际错误是表中的外键列不接受null,并且该条目未提供该列的数据。如果您使用了流畅的api,一个选项是您可以将IsRequired()更改为IsOptional()以进行外键映射