What is the difference between ISession.SaveOrUpdateCopy() and ISession.Merge()?

SaveOrUpdateCopy is now considered obsolete and thus Merge is meant to take over for it (hence its extreme similarity).

SaveOrUpdateCopy is now considered obsolete and thus Merge is meant to take over for it (hence its extreme similarity). They are pretty much the same except I don't think those cascade options were available with SaveOrUpdateCopy. However, that point is moot as Merge should be method you use.

UPDATE: I went in to the source code of Nbernate just to make sure they are as similar as I was thinking and here is what I found. Both Merge and SaveOrUpdateCopy have very similar implementations: public object Merge(string entityName, object obj) { using (new SessionIdLoggingContext(SessionId)) { return FireMerge(new MergeEvent(entityName, obj, this)); } } public object SaveOrUpdateCopy(object obj) { using (new SessionIdLoggingContext(SessionId)) { return FireSaveOrUpdateCopy(new MergeEvent(null, obj, this)); } } Their FireXXXX methods are also very similar: private object FireMerge(MergeEvent @event) { using (new SessionIdLoggingContext(SessionId)) { CheckAndUpdateSessionStatus(); IMergeEventListener mergeEventListener = listeners. MergeEventListeners; for (int I = 0; I Length; i++) { mergeEventListeneri.

OnMerge(@event); } return @event. Result; } } private object FireSaveOrUpdateCopy(MergeEvent @event) { using (new SessionIdLoggingContext(SessionId)) { CheckAndUpdateSessionStatus(); IMergeEventListener saveOrUpdateCopyEventListener = listeners. SaveOrUpdateCopyEventListeners; for (int I = 0; I Result; } } The methods are exactly the same except they draw on different event listener lists, but even the types of the lists (IMergeEventListener) are the same!

Looking at the listener lists, they are both initialized with a default listener. The default listener for the Merge listen handlers is of type DefaultMergeEventListener while the SaveOrUpdateCopy is DefaultSaveOrUpdateCopyEventListener. Thus, the difference between them is just the difference in these two implementations (that is if you keep the default listener, which is 99% of the time).

However, the real interesting fact IS the difference in implementation. If you look at DefaultSaveOrUpdateCopyEventListener you get this: public class DefaultSaveOrUpdateCopyEventListener : DefaultMergeEventListener { protected override CascadingAction CascadeAction { get { return CascadingAction. SaveUpdateCopy; } } } This means the default behavior for Merge and SaveOrUpdateCopy only differs in the cascading actions, everything else is exactly the same.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions