I’m using table splitting to map entities Entity1 and Entity2 to a DB table MyTable.
Is there a way to insert a new row into MyTable by adding an instance of Entity1 (or Entity2) to the context and let EF construct the necessary Insert command. I tried the following, but it throws an exception:
Entity2 entity = new Entity2();
context.Entity2.AddObject(entity);
context.SaveChanges();// UpdateException: Invalid data encountered. A
// required relationship is missing
thank you
You must always construct whole record for the split table so if your Entity1 contains navigation property to Entity2 it must be filled: