Question

Documentation says, SubmitChanges updates only changed values.

My question is what exactly that means ? Let's say a simple example:

row.Variable = 5;   ( row.Variable contained 4 before change )

This is clear to me. It will update. What about this ?

row.Variable = 5;   ( row.Variable contained 5 before change )

Well, will it update as I changed it to same value or It knows it's same and it will not update ? Thank you :)

Était-ce utile?

La solution 2

SubmitChanges updates only changed values.

(emphasis mine)

If there isn't any change, it I suppose it will not update as it is overkill to do nothing.

So, it will only update if the value is different from what is already stored. If not, then it is bad design.

Autres conseils

SubmitChanges will update the values that is deference from the stored one. You can checkout this function that give you the answare:

DataContext db = new DataContext();

... //do some thing

var changeSet = db.GetChangesSet();
var updatesCount = changeSet.Updates.Count;

That will be show you the changes count (if any).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top