It might not suit you at all... In some use cases in our fat client we use something like this... aggRoot = fetchUsingSession1(); clonedAgg = aggRoot.Clone(); [...] aggRoot.Something=changedValue; [...] session2.Lock(clonedAgg, lockmode.none); session2.Merge(aggRoot);
We need to clone the original state for other reasons. As a bonus we can give session2 a hint of what the org state was (to get rid of the select in the select/update). If you don't need to keep a clone for other reasons - this approach is probably not for you. /Roger ________________________________________ Från: [email protected] [[email protected]] för taoufik [[email protected]] Skickat: den 18 februari 2010 12:58 Till: nhusers Ämne: [nhusers] Implement own IsDirty in nHibernate For my current project, we use a nHibernate session to retrieve the object, and another session to update the changes we've made to the object in between the two session. If we use SaveOrUpdate(), nHibernate will typically do a select-then-update (so, two calls to the database). However, our own business objects already keep track of changes. So, we'd ideally want to intercept within nHibernate and vote whether the object has been changed or not (without letting nHibernate do the select-statement). Would that be possible with an interceptor? -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
