Skip to main content
.NET 6.0+

RuleBaseAttribute.TargetContextIDs Property

Specifies a context for checking the current Rule.

Namespace: DevExpress.Persistent.Validation

Assembly: DevExpress.Persistent.Base.v24.1.dll

Declaration

public string TargetContextIDs { get; set; }

Property Value

Type Description
String

A string representing a list of identifiers of the contexts when the current rule should be checked.

Remarks

When defining a rule via a validation attribute, you should specify the contexts when this rule will be checked. For this purpose, pass a string containing a list of context identifiers separated by semicolons as the targetContextIDs parameter. A context identifier can be represented by any string value. To associate a context identifier with a particular Action, set it for the ValidationContexts property of the Application Model‘s ActionDesign | Actions | <Action> node. Via this property, you can associate any number of context identifiers with one Action, by listing them, separated by semicolons.

In addition to the Action-associated contexts, you can use predefined contexts represented by the DefaultContexts.Save and DefaultContexts.Delete enumeration values. The Save context occurs when data is committed to the database (see BaseObjectSpace.CommitChanges). The Delete context occurs when an object is deleted from the database (see BaseObjectSpace.Delete).

The contexts specified for a validation rule in code are set for the TargetContextIDs property of the IModelRuleBase node. So, you can customize the context identifiers list directly in the Application Model.

Note

You can specify an additional contextual criteria for a rule. If this criteria is satisfied by the validated object or property, the rule is checked. To do this, use RuleBaseAttribute.TargetCriteria.

Implements

See Also