0

私は 2 つのまったく同じデータベース テーブルを持っています。1 つは prod で、もう 1 つは dev です。開発データベースにデプロイするたびに、すべて正常に動作します。また、prod データベースでは、EF と MVC を使用してデータをデータベースに書き戻そうとすると、このエラーがスローされます。

System.InvalidOperationException: 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.
   at System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options)
   at System.Data.Entity.Internal.InternalContext.SaveChanges()

そしてもちろん、私はこれをチェックしましたhttp://blogs.msdn.com/b/dsimmons/archive/2010/01/31/deleting-foreign-key-relationships-in-ef4.aspx

私のEFコードに問題はないようです。純粋にdbテーブルの問題です とにかく詳細を見つけることができますか?

4

1 に答える 1