By the way, I am not asking for others to do my work for me, I am trying to find out if there are NHibernate features I am not aware of which can make my life a little bit easier. I already implemented a general solution do do post-condition checks. If anyone is interested, here is the general outline of the solution, and again, maybe you can give me some advice on how I can do this simpler using NHibernate technologies I am not aware of:
i) I have Save, Update and Delete event listeners which check which (properties on which) objects have been saved, updated or deleted (this way i don't need to implement INotifyPropertyChanged everywhere). ii) These listeners register the necessary post-condition validations to be done. For example, an event listener for the folders "public class FolderListenerValidation : ISaveOrUpdateEventListener" will register a folder for a post-condition tree-cycle-validation. (Another use could be to register which changes should be logged or exported at the end of the transaction, not just validated) iii) In BeforeTransactionCompletion all registered post-condition validations will be sent to the corresponding handlers for the validation. A clean session with the same transaction of the main session (session.GetSession()) is passed to each handler. The handler can now perform all validations/post-condition checks inside the new session (locking data, retrieiveing "clean" data - not via identity map but from datastore, i.e. no inconsistent read, etc.). This is working fine, and I am only using this complex mechanism for validations that cannot be performed inside an aggregate, i.e for invariants not protected by the aggregate root. Are there any aspects of NHibernate I am not aware of that can simplify this process? Am I just plain crazy doing it like this :-)? My background is working with datasets and a procedural style of programming, so maybe I need to change my way of thinking about things like validation, etc. thanx, ramin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
