Dbset.attach (good); var stateentry = ((iobjectcontextadapter) context). ObjectContext. Objectstatemanager.getobjectstateentry (good); Stateentry.setmodified (); Stateentry.setmodifiedproperty ("Title"); Stateentry.setmodifiedproperty ("Updatedate"); Context. SaveChanges ();
If it appears
Validation of one or more entities failed. For more information, see the "Entityvalidationerrors" property
The validation entity validity (validateonsaveenabled) switch must be turned off before SaveChanges
Final code
Dbset.attach (good); var stateentry = ((iobjectcontextadapter) context). ObjectContext. Objectstatemanager.getobjectstateentry (good); Stateentry.setmodified (); Stateentry.setmodifiedproperty ("Title"); Stateentry.setmodifiedproperty ("Updatedate"); Context. configuration.validateonsaveenabled = false; Context. SaveChanges (); Context. Configuration.validateonsaveenabled = true;
Entity Framework 5 updates the specified field