There is a not very known interface called NHibernate.Classic.IValidatable that describes a single method, Validate. If your entities implement this interface, this method will be called upon Save or Update, and you can perform your own validation there. If the entity is not valid, you can throw an exception and the saving will be aborted.
RP On Tuesday, March 27, 2012 8:39:08 AM UTC+1, Peter Morris wrote: > > I've been reading through a page describing NHibernate Validator. I > was wondering how I would add a very class specific validation, as > creating an attribute seems to be the wrong way to write something so > specific. For example > > Description: Start date cannot be before previous end date > Psuedo code: this.Index == 0 or this.StartDate >= > this.Parent.Children[this.Index - 1].EndDate > > What would be the best way to implement this kind of thing? -- 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/-/d2SAXqeFzc8J. 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.
