Assembly: Microsoft.VisualStudio.Modeling.Sdk (in microsoft.visualstudio.modeling.dll)
A Rule in a model is a class that derives from one of these Rules (such as AddRule), and overrides one or more of its methods (such as ElementAdded).
A Rule in a model also needs aattribute placed on the class. This indicates what type the Rule works on and when the rule should raise (inline, local transaction commit, or top-level transaction commit).
Rules occur within the context of the transaction they are in. that is, if you define a Rule that raises when the top level transaction commits, that Rule will raise immediately before the transaction commits.
Something that is done in a Rule can cause other Rules to raise, and these will also occur before the transaction (local or top level) commits.
If you set the firing time to inline in the RuleOn attribute, the Rule will raise immediately when the change the Rule is associated with occurs on the type of object specified in the attribute.