Validation question

Validation question

Old forum URL: forums.lhotka.net/forums/t/9409.aspx


lee_mre posted on Thursday, August 19, 2010

I have a root object which has a child.

There are strings that are required in the child object only when the parent object has a property set to some specific value.

 

How would I perform validation in this sceneario?

 

Thx

-wen

RockfordLhotka replied on Saturday, August 21, 2010

This is a two step process:

  1. Implement an internal method on the child that calls BusinessRules.CheckRules(). The child object's rules obviously interact with Parent to find that value you mention.
  2. Implement a rule that calls this internal method on the child, and attach that rule to the parent object's property, so when the important property is changed, this rule is run and it calls the internal method on the child, which runs the rules in the child.

 

Copyright (c) Marimer LLC