Validation - how do I know what to validate?

Topics: Validation Application Block
Oct 3, 2007 at 2:23 AM
Does the Validation Application Block know anything about which objects needs to be validated? If not, is there a good way to keep track of this?

Let's say I have an object called "Category" and an object called "Product". A Category can contain multiple Products. Obviously if a property on an object changes, that can trigger validation. But what happens when a Product is added or removed from a Category? In this case the Category should be validated, but is there anything in the Validation Application Block (or some pattern) that will help me do this?

Oct 3, 2007 at 12:02 PM
Hi Jon,

The VAB will validate when the objects its passed as arguments based on the validation specifications indicated through configuration or attributes. It does not model what needs to be validated when a certain object in an object graph changes.

You can add custom code to fire this validation, or use some custom PIAB handler to fire validation of the parent.