I'm using Entity Framework 6.1.3 in a .NET 4.5 application with Code First and a hand-crafted table schema on an Oracle database server. Most things work fine. For a new function the following exception is thrown in SaveChanges:
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.
Stack trace:
- System.Data.Entity.Core.Objects.ObjectContext.PrepareToSaveChanges(System.Data.Entity.Core.Objects.SaveOptions)
- System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(System.Data.Entity.Core.Objects.SaveOptions, bool)
- System.Data.Entity.Internal.InternalContext.SaveChanges()
- (my code)
It says nothing about the problem. It doesn't help me to find it. The SQL log is empty so I guess the problem was detected by EF locally before even trying to reach out to the database.
My question is: How can I debug this thing? Where's the details about which foreign key in which object has which value but shouldn't have it? Are there trace logs available for Entity Framework that contain internal data about what was done?
The situation is way too complex to show it here so please don't ask for it. I want to help myself out of this, I just need assistence with that.