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.
In
InMemoryEnginethe Save will return the number of entities that already exist and updates them where necessary. InSQLEnginethe Save will return the number of entities to be updated. In the case where the item exists but doesn't need to be updatedInMemoryEnginereturns 1 andSQLEnginereturns 0. The 0 returned fromSQLEnginethen prompts the Insert.Save()return values:Save()!=Exists()inSQLEngineis there a better method to check whether something already exists inInsertOrUpdate()or shouldSave()change so that is is synonymous with exists.Either way
InMemoryEngineandSQLEngineshould give the same results.