|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
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.