I am trying to remove all data from a table and re-add it, but I get the below exception:
An exception of type 'System.InvalidOperationException' occurred in EntityFramework.dll but was not handled in user code Additional information: 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 first I though it was pretty obvious, until I looked at my database (below). To check if I was missing something I deleted all relevant rows in SSMS successfully. If I can delete the rows without foreign key constraints in SQL, why cant I do it in EF?
EDIT: I am trying to delete from the rooms table