Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
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.

Rule Class

Compares rules and determines when they are raised.

Namespace: Microsoft.VisualStudio.Modeling
Assembly: Microsoft.VisualStudio.Modeling.Sdk (in microsoft.visualstudio.modeling.dll)

public abstract class Rule : IComparable, IComparable<Rule>
public abstract class Rule implements IComparable, IComparable<Rule>
public abstract class Rule implements IComparable, IComparable<Rule>

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 a RuleOnAttribute attribute 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.

     Derived Classes

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

© 2015 Microsoft