You can validate and vetoing save/update/delete registering listeners for IPreInsertEventListener, IPreUpdateEventListener, IPreDeleteEventListener
You can change/log any information of your entity registering others listeners as, just for example, ISaveOrUpdateEventListener, IFlushEntityEventListener. On Tue, Mar 29, 2011 at 8:10 AM, David Laabs <[email protected]>wrote: > I wrote a complete nhibernate mapping of a class library (NHibernate > 3.0, C# .Net 4, Oracle DB), All works very well. > Now I would like to add two thinks for which it would be great if > there were a chance to have a "save object" callback. I mean that > nhibernate jumps to a given function within my object before it is > saved (i.e. a virtual PreSave). Or maybe there is a different way for > doing this: > > 1. Id like to validate the consistency of the data within my objects > in combination with all sub objects hanging on them... For example: I > have a transaction with transaction_positions. I'd like to validate > that the sum of all positions in my transaction is 0 before saving is > alowed. > > 2. I use the change information of nhibernate (see > > http://groups.google.com/group/nhusers/browse_thread/thread/d134f1fa0e304904/c080ae583a02967c?lnk=gst&q=laabs#c080ae583a02967c > ) > which tells me what of my object is changed and how. That works > fine... Now I'd like to log those informations to my database. With > the PreSave callback it would be very easy to see which objects will > be saved from nhibernate. > > Thanks for every help :-) > > -- > 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. > > -- Fabio Maulo -- 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.
