dashing icon indicating copy to clipboard operation
dashing copied to clipboard

InsertOrUpdate doesn't work for unchanged entities

Open Itzalive opened this issue 5 years ago • 0 comments

In InMemoryEngine the Save will return the number of entities that already exist and updates them where necessary. In SQLEngine the Save will return the number of entities to be updated. In the case where the item exists but doesn't need to be updated InMemoryEngine returns 1 and SQLEngine returns 0. The 0 returned from SQLEngine then prompts the Insert.

Save() return values:

                 | Exists no change | Exists change needed | Does not exist
InMemoryEngine   |       1          |           1          |         0
SQLEngine        |       0          |           1          |         0

Save() != Exists() in SQLEngine is there a better method to check whether something already exists in InsertOrUpdate() or should Save() change so that is is synonymous with exists.

Either way InMemoryEngine and SQLEngine should give the same results.

Itzalive avatar May 07 '20 16:05 Itzalive