I have an import, from flat file to an EDM against SQL Server, where very few records actually change (running it the umpteenth time with the same import file), but nonetheless the SaveChanges call to update 500 records takes quite long. I'm guessing this is because I set each property on the entity object, and EF then uses ReportPropertyChanged
to signal that the record must be updated in the DB.
Do I actually have to compare all import recort property values to entity property values, and only assign to the entity property when they differ, to avoid these lengthy 'do-nothing' updates?
EDIT: The generated code for the setter for the Updated property looks like below. I can see the assignment is unconditional, which is why I'm asking if the actual generation of an UPDATE statement to the DB is conditional or not.
set
{
OnUpdatedChanging(value);
ReportPropertyChanging("Updated");
_Updated = StructuralObject.SetValidValue(value);
ReportPropertyChanged("Updated");
OnUpdatedChanged();
}