I want to update a parent entity ONLY that contains a child entity also preventing child from inserting a new record is null for the child.
But I am receiving the error:
Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.
or sometimes complaining that:
Child entity is null therefore cannot update
Suppose I have:
public void updateParentModel(myModel model)
{
mycontext.Entry(model).State = System.Data.Entity.EntityState.Modified;
mycontext.SaveChanges();
}
I tried this below and it's also not working:
//mycontext.Entry(model).Property(x => x.Serviced).IsModified = true;