Skip to main content
.NET 8.0+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

RuleBaseAttribute.SkipNullOrEmptyValues Property

Specifies whether the current rule is checked for the properties that are set to null (Nothing in VB), an empty string (for string type propeties) or a minimal date (for DateTime type properties).

Namespace: DevExpress.Persistent.Validation

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

#Declaration

public bool SkipNullOrEmptyValues { get; set; }

#Property Value

Type Description
Boolean

true if null-like values are not checked by the current rule; otherwise, false.

#Remarks

When defining a rule, you can specify whether to consider the properties that are set to null, an empty string (for string type propeties) or a minimal date (for DateTime type properties) when checking the rule. To set the required behavior for a rule that is defined via a validation attribute, use the named SkipNullOrEmptyValues parameter.

[RuleUniqueValue(DefaultContexts.Save, SkipNullOrEmptyValues = false)]
public string UniqueValue { 
   //...
}

By default, SkipNullOrEmptyValues is set to false in the RuleRequiredField rule; in the remaning validation rules, it is set to true.

The SkipNullOrEmptyValues behavior specified for a validation rule in code is set for the SkipNullOrEmptyValues property of the Application Model’s IModelRuleBase node. So, you can change this behavior directly in the Model Editor.

See Also