One thing you can do is call Flush() on the ISession, or otherwise
trigger a flush after removal of the first element and before addition
of the new element. Not the most beautiful code though.
/Oskar
Well that is probably his goal but code wise not really efficient. I often have the same problem which I usually solve by performing a .Clear() and then adding the items by creating new items based on a collection of dto items. These items are 99% of the time the exact same items value wise. Adding add/update/delete logic often is a shitload of code thus increased development time.
why not update the record rather than delete and insert?
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/nhusers/-/81zueJdpjhkJ.
To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
Now my question is how can i change the sequence, i want nhibernate to fire delete statement first and then insert.
...
Chetan Chaphekar--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
Delete then Insert can lead to it’s own set of problems. From a “pure” standpoint, the deletes and inserts need to be sorted by time of occurrence, optimized to remove redundant operations, and then batched and fired.
I do not know of any way to do this with nHibernate, but there are some libraries that will do this directly at the ADO.Net level.
/Oskar
2011/12/8 chetan chaphekar <cchap...@gmail.com>: