Hello,
I’m writing a process for which, after careful consideration, I need to use a reduced delta. For updating the entity, I do something like:
MyDomainService.ProcessEntity(myEntity);
Repository.Save(myEntity); // this calls lda.Update(myEntity_oldValues, myEntity)
Repository.ApplyChanges();
The “ProcessEntity” method might or might not change the myEntity, as I need the process to be idempotent, but if I don’t change the entity, and I Save/ApplyUpdates, I get the error at the server “Fields collection for UPDATE command is empty”. Looking at the delta received, I see I only receive the Primary_Key field and the rest of values (old and new) are null. This, of course, generates the error.
My question is: shouldn’t the LinqDataAdapter realize that there is nothing to update and simply not call the server with an empty delta?
I know I can (and will) add a check in the Save method to avoid sending an empty update, but since the LinqDataAdapter already has a process for generating the delta, it should be the one with the check for empty updates. Or is there already a way to check for this? Adding a manual check is tedious and too much extra code, .
Thanks,
Arturo.