Validation of Business Objects is a common issue, but there are some solutions to solve that.
One of these solutions is to use the standalone NHibernate.Validator fr
I don´t know if we are talking about the same idea, but if we are, I like what you explain. Very quickly, I´ll explain what I do to solve this. In my case, all the bussines objects in my domain layer must override two methods:
Obviously, to maintain this, I have more classes implicated, but I´ll not write all here, cos I´m only trying to explain the concept
List notPassedValidationRules = new List();
//...
public override void ValidateErrorsWhenSaving(Validator validator)
{
//...
}
public override void ValidateErrorsWhenDelete(Validator validator)
{
//...
}
In these methods, I check for some boolean conditions, mantaining a collection of non passed rules. In my case, these methods are invoked before my Unit Of Work commits the changes (inserting new entities, updating, deleting), and show possible errors to the user, before commiting.