I am using entity framework 4 and have the following setup and problem.
I have a table in MySql with metadata fields an a blob field. Using the Table Splitting technique described here i have divided the table into two entities (DataItem and DataItemDetails). This way I can load all the metadata without loading the blobs.
Problem is that when I try to delete a dataitem entity I get this exception:
exception: System.Data.UpdateException: Invalid data encountered. A required relationship is missing. Examine StateEntries to determine the source of the constraint violation.
If I turn of Lazy Loading or load the DataItemDetail part i can delete the DataItem.
This is OK, but I don't want to load the data just to delete it.
if (!D.DataItemDetailReference.IsLoaded)
D.DataItemDetailReference.Load();
_db.DataItems.DeleteObject(d);
_db.SaveChanges();
_db is the ObjectContext dereived class and D is an instance of the DataItem class.