When an object of a specific type is added to the model and you want to do something programmatically, you define a class derived from AddRule.
A RuleOnAttribute attribute placed on the class indicates what type of object the Rule works on and when the rule should fire.
The rule is called when the object of the specified type is added to the model, whether it is added in the UI or programmatically.