A dependent property in a ReferentialConstraint is mapped to a store-generated column

后端 未结 13 1466
终归单人心
终归单人心 2020-11-27 17:23

I get this error when writing to the database:

A dependent property in a ReferentialConstraint is mapped to a store-generated column. Column: \'Paym

13条回答
  •  無奈伤痛
    2020-11-27 17:55

    Re-check the relationship between Payment and the other tables/entities. Including the ones that shouldn't contain PaymentId because that's where the problem is most likely hiding.

    When creating foreign keys in SQL Server Management Studio, the primary key is defaulted, and this default is reverted when the parent table is changed, so be careful to change values in the correct order in the "Tables and Columns" window.

    Also, after you've fixed the problematic relationship, there's a good chance that a simple "Refresh" on the model won't correctly remove the erronous relationship from the model and you'll get the same error even after the "fix", so do this yourself in the model before performing a refresh. (I found this out the hard way.)

提交回复
热议问题