NHibernate.Mapping.Attributes
NHibernate.Mapping.Attributes copied to clipboard
NHMA-29 - Add a "try" possibility to unsaved-value for SaveOrUpdate with assigned Guid
Michel Van Hoof created issue - 13/Nov/09 9:46 PM
I know the question has been asked many times but it seems to make sense:
We often have to replicate data between different systems where we want to keep the original guids of the data. when wanting to do so using Nhibernate, we cannot use the SaveOrUpdate possibility since there is only the option of:
always save Always update save when id = null save when id = null or "value"
So basically, if you want to use SaveOrUpdate, you cannot assign your own guid's as primary keys.
In data replication situations (for example receiving data from another application using a messagequeue) you have to first check if an object is already present and then decide to save or update.
It would be nice to have an option saying "try" which would do this for you (so query the database/persistence to see if an object with the given id already exists, if not= save, else = update)