locked
Table splitting – how do we insert a new row? RRS feed

  • Question

  • hi

    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


    • Edited by KlemS100 Thursday, December 22, 2011 8:00 PM
    Thursday, December 22, 2011 8:00 PM

Answers